nlptoolkit-postagger 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -0
- package/brown.txt +89329 -0
- package/dist/DummyPosTagger.d.ts +20 -0
- package/dist/DummyPosTagger.js +47 -0
- package/dist/DummyPosTagger.js.map +1 -0
- package/dist/HmmPosTagger.d.ts +21 -0
- package/dist/HmmPosTagger.js +56 -0
- package/dist/HmmPosTagger.js.map +1 -0
- package/dist/NaivePosTagger.d.ts +21 -0
- package/dist/NaivePosTagger.js +61 -0
- package/dist/NaivePosTagger.js.map +1 -0
- package/dist/PosTaggedCorpus.d.ts +15 -0
- package/dist/PosTaggedCorpus.js +75 -0
- package/dist/PosTaggedCorpus.js.map +1 -0
- package/dist/PosTaggedWord.d.ts +16 -0
- package/dist/PosTaggedWord.js +35 -0
- package/dist/PosTaggedWord.js.map +1 -0
- package/dist/PosTagger.d.ts +6 -0
- package/dist/PosTagger.js +13 -0
- package/dist/PosTagger.js.map +1 -0
- package/index.js +6 -0
- package/package.json +31 -0
- package/source/DummyPosTagger.ts +38 -0
- package/source/HmmPosTagger.ts +51 -0
- package/source/NaivePosTagger.ts +53 -0
- package/source/PosTaggedCorpus.ts +62 -0
- package/source/PosTaggedWord.ts +25 -0
- package/source/PosTagger.ts +9 -0
- package/source/tsconfig.json +13 -0
- package/tests/DummyPosTaggerTest.ts +26 -0
- package/tests/HmmPosTaggerTest.ts +26 -0
- package/tests/NaivePosTaggerTest.ts +26 -0
- package/tsconfig.json +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
This is a tool meant for tagging words with their part-of-speech, a grammatical category based on their function within a sentence, such as noun, adjective, verb, and so forth.
|
|
2
|
+
|
|
3
|
+
For Developers
|
|
4
|
+
============
|
|
5
|
+
|
|
6
|
+
You can also see [Python](https://github.com/starlangsoftware/EnglishPosTagger-Py), [Cython](https://github.com/starlangsoftware/EnglishPosTagger-Cy),
|
|
7
|
+
[C++](https://github.com/starlangsoftware/EnglishPosTagger-CPP), [Swift](https://github.com/starlangsoftware/EnglishPosTagger-Swift),
|
|
8
|
+
[Java](https://github.com/starlangsoftware/EnglishPosTagger), or [C#](https://github.com/starlangsoftware/EnglishPosTagger-CS) repository.
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
* [Node.js 14 or higher](#Node.js)
|
|
13
|
+
* [Git](#git)
|
|
14
|
+
|
|
15
|
+
### Node.js
|
|
16
|
+
|
|
17
|
+
To check if you have a compatible version of Node.js installed, use the following command:
|
|
18
|
+
|
|
19
|
+
node -v
|
|
20
|
+
|
|
21
|
+
You can find the latest version of Node.js [here](https://nodejs.org/en/download/).
|
|
22
|
+
|
|
23
|
+
### Git
|
|
24
|
+
|
|
25
|
+
Install the [latest version of Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
|
26
|
+
|
|
27
|
+
## Npm Install
|
|
28
|
+
|
|
29
|
+
npm install nlptoolkit-postagger
|
|
30
|
+
|
|
31
|
+
## Download Code
|
|
32
|
+
|
|
33
|
+
In order to work on code, create a fork from GitHub page.
|
|
34
|
+
Use Git for cloning the code to your local or below line for Ubuntu:
|
|
35
|
+
|
|
36
|
+
git clone <your-fork-git-link>
|
|
37
|
+
|
|
38
|
+
A directory called util will be created. Or you can use below link for exploring the code:
|
|
39
|
+
|
|
40
|
+
git clone https://github.com/starlangsoftware/englishpostagger-js.git
|
|
41
|
+
|
|
42
|
+
## Open project with Webstorm IDE
|
|
43
|
+
|
|
44
|
+
Steps for opening the cloned project:
|
|
45
|
+
|
|
46
|
+
* Start IDE
|
|
47
|
+
* Select **File | Open** from main menu
|
|
48
|
+
* Choose `Postagger-Js` file
|
|
49
|
+
* Select open as project option
|
|
50
|
+
* Couple of seconds, dependencies will be downloaded.
|
|
51
|
+
|
|
52
|
+
Detailed Description
|
|
53
|
+
============
|
|
54
|
+
|
|
55
|
+
+ [PosTagger](#postagger)
|
|
56
|
+
|
|
57
|
+
## PosTagger
|
|
58
|
+
|
|
59
|
+
To train the PosTagger which is used for English pos tagging
|
|
60
|
+
|
|
61
|
+
train(self, corpus: PosTaggedCorpus)
|
|
62
|
+
|
|
63
|
+
To save the trained PosTagger model
|
|
64
|
+
|
|
65
|
+
saveModel(self)
|
|
66
|
+
|
|
67
|
+
To load an already trained PosTagger model
|
|
68
|
+
|
|
69
|
+
loadModel(self)
|
|
70
|
+
|
|
71
|
+
To tag a sentence, using a newly trained or loaded PosTagger model
|
|
72
|
+
|
|
73
|
+
posTag(self, sentence: Sentence) -> Sentence
|
|
74
|
+
|
|
75
|
+
3 different PosTagger models are supported: The one that is used to tag the sentences with a random tag
|
|
76
|
+
|
|
77
|
+
DummyPosTagger
|
|
78
|
+
|
|
79
|
+
the one that tags the word with the most used tag for a given word
|
|
80
|
+
|
|
81
|
+
NaivePosTagger
|
|
82
|
+
|
|
83
|
+
the one that does an Hmm based training and tags the words accordingly
|
|
84
|
+
|
|
85
|
+
HmmPosTagger
|