The purpose of this widget is to create the list of keywords. This widget allows users to generate keywords from the text block and allow to add custom keywords as well.
Grab all the modules:
npm installBuild project:
npm run buildDevelopment mode and watch
npm run watchYou can add the keyword extractor widget to a Group field in semantics.json like
so:
"name": "keywordExtractorGroup",
"label": "Keyword extractor",
"type": "group",
"widget": "KeywordExtractor",
"keywordExtractor": {
"buttons": {
"contentText": "extractKeywords",
"customKeywords": "parseKeywordsComma"
},
"keywords": "keywords"
},
Here,
- the widget is added by
"widget": "KeywordExtractor"(you need to add the widget as a library dependency as well, of course), - one button to perform slightly intelligent keyword extraction from a text in a
Textfield (optionally using aTextareawidget) is set to be the field with the namecontentText, - one button to perform simple keyword extraction from a comma separated list of
keywords in a
Textfield is set to be the field with the namecustomKeywords, - the
Textfield that is supposed store the keywords is set to be field with the namekeywords.
A complete Group field could look like this in semantics.json:
{
"name": "keywordExtractorGroup",
"label": "Keyword extractor",
"type": "group",
"importance": "low",
"expanded": true,
"widget": "KeywordExtractor",
"keywordExtractor": {
"buttons": {
"contentText": "extractKeywords",
"customKeywords": "parseKeywordsComma"
},
"keywords": "keywords"
},
"fields": [
{
"name": "contentText",
"label": "Content",
"description": "Reference text block for users.",
"type": "text",
"importance": "medium",
"optional": true,
"widget": "textarea"
},
{
"name": "customKeywords",
"description": "Add custom keywords of your choice, separated by comma.",
"type": "text",
"label": "Add keywords",
"importance": "low",
"optional": true
},
{
"name": "keywords",
"description": "Below listed keywords will available for users.",
"label": "Keywords",
"type": "text",
"importance": "medium",
"optional": true,
"maxLength": 5000
}
]
}