You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[**retext**][retext] plugin to extract keywords and key-phrases.
12
+
13
+
## Install
6
14
7
15
[npm][]:
8
16
9
-
```bash
17
+
```sh
10
18
npm install retext-keywords
11
19
```
12
20
13
-
## Usage
21
+
## Use
14
22
15
23
Say we have the following file, `example.txt`, with the first four paragraphs
16
24
on [Term Extraction][term-extraction] from Wikipedia:
17
25
18
-
```text
26
+
```txt
19
27
Terminology mining, term extraction, term recognition, or glossary extraction, is a subtask of information extraction. The goal of terminology extraction is to automatically extract relevant terms from a given corpus.
20
28
21
29
In the semantic web era, a growing number of communities and networked enterprises started to access and interoperate through the internet. Modeling these communities and their information needs is important for several web applications, like topic-driven web crawlers, web services, recommender systems, etc. The development of terminology extraction is essential to the language industry.
@@ -25,9 +33,9 @@ One of the first steps to model the knowledge domain of a virtual community is t
25
33
Typically, approaches to automatic term extraction make use of linguistic processors (part of speech tagging, phrase chunking) to extract terminological candidates, i.e. syntactically plausible terminological noun phrases, NPs (e.g. compounds "credit card", adjective-NPs "local tourist information office", and prepositional-NPs "board of directors" - in English, the first two constructs are the most frequent). Terminological entries are then filtered from the candidate list using statistical and machine learning methods. Once filtered, because of their low ambiguity and high specificity, these terms are particularly useful for conceptualizing a knowledge domain or for supporting the creation of a domain ontology. Furthermore, terminology extraction is a very useful starting point for semantic similarity, knowledge management, human translation and machine translation, etc.
26
34
```
27
35
28
-
And our script, `example.js`, looks as follows:
36
+
…and our script, `example.js`, looks as follows:
29
37
30
-
```javascript
38
+
```js
31
39
var vfile =require('to-vfile')
32
40
var retext =require('retext')
33
41
var keywords =require('retext-keywords')
@@ -58,7 +66,7 @@ function done(err, file) {
58
66
59
67
Now, running `node example` yields:
60
68
61
-
```text
69
+
```txt
62
70
Keywords:
63
71
term
64
72
extraction
@@ -80,8 +88,9 @@ communities
80
88
81
89
Extract keywords and key-phrases from the document.
82
90
83
-
The results are stored on `file.data`: keywords at `file.data.keywords`
84
-
and key-phrases at `file.data.keyphrases`. Both are lists.
91
+
The results are stored on `file.data`: keywords at `file.data.keywords` and
92
+
key-phrases at `file.data.keyphrases`.
93
+
Both are lists.
85
94
86
95
A single keyword looks as follows:
87
96
@@ -97,7 +106,7 @@ A single keyword looks as follows:
97
106
}
98
107
```
99
108
100
-
...and a key-phrase:
109
+
…and a key-phrase:
101
110
102
111
```js
103
112
{
@@ -112,22 +121,23 @@ A single keyword looks as follows:
112
121
}
113
122
```
114
123
115
-
###### `options`
124
+
###### `options.maximum`
116
125
117
-
*`maximum` (default: `5`) — Try to detect `words` and `phrases`
118
-
words;
126
+
Try to detect at most `maximum``words` and `phrases` (`number`, default: `5`).
119
127
120
-
Note that actual counts may differ. For example, when two words
121
-
have the same score, both will be returned. Or when too few words
122
-
exist, less will be returned. the same goes for phrases.
128
+
Note that actual counts may differ.
129
+
For example, when two words have the same score, both will be returned.
130
+
Or when too few words exist, less will be returned. the same goes for phrases.
123
131
124
132
## Contribute
125
133
126
-
See [`contributing.md` in `retextjs/retext`][contributing] for ways to get
127
-
started.
134
+
See [`contributing.md`][contributing] in [`retextjs/.github`][health] for ways
135
+
to get started.
136
+
See [`support.md`][support] for ways to get help.
128
137
129
-
This organisation has a [Code of Conduct][coc]. By interacting with this
130
-
repository, organisation, or community you agree to abide by its terms.
138
+
This project has a [Code of Conduct][coc].
139
+
By interacting with this repository, organisation, or community you agree to
140
+
abide by its terms.
131
141
132
142
## License
133
143
@@ -147,20 +157,34 @@ repository, organisation, or community you agree to abide by its terms.
0 commit comments