@devil7softwares/pos
Advanced tools
Comparing version 1.0.1 to 1.0.2
export * from './enums'; | ||
export * from './Lexer'; | ||
export * from './Tagger'; | ||
export * from './TagNameMap'; | ||
export * from './types'; | ||
export * from './Tagger'; | ||
export * from './Lexer'; |
@@ -14,4 +14,5 @@ "use strict"; | ||
__exportStar(require("./enums"), exports); | ||
__exportStar(require("./Lexer"), exports); | ||
__exportStar(require("./Tagger"), exports); | ||
__exportStar(require("./TagNameMap"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./Tagger"), exports); | ||
__exportStar(require("./Lexer"), exports); |
@@ -16,5 +16,5 @@ "use strict"; | ||
unblank: /\S/, | ||
email: /[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](?:\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](?:-?\.?[a-zA-Z0-9])*(?:\.[a-zA-Z](?:-?[a-zA-Z0-9])*)+/gi, | ||
urls: /(?:https?:\/\/)(?:[\da-z\.-]+)\.(?:[a-z\.]{2,6})(?:[\/\w\.\-\?#=]*)*\/?/gi, | ||
punctuation: /[\/\.\,\?\!\"\'\:\;\$\(\)\#\’\`]/gi, | ||
email: /[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](?:\.?[-!#$%&'*+/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](?:-?\.?[a-zA-Z0-9])*(?:\.[a-zA-Z](?:-?[a-zA-Z0-9])*)+/gi, | ||
urls: /(?:https?:\/\/)(?:[\da-z.-]+)\.(?:[a-z.]{2,6})(?:[/\w.\-?#=]*)*\/?/gi, | ||
punctuation: /[/.,?!"':;$()#’`]/gi, | ||
time: /(?:[0-9]|0[0-9]|1[0-9]|2[0-3]):(?:[0-5][0-9])\s?(?:[aApP][mM])/gi, | ||
@@ -41,6 +41,5 @@ }; | ||
var nextRegex = regexs[0], nextRegexes = regexs.slice(1); | ||
for (var i in childElements) { | ||
if (childElements.hasOwnProperty(i)) { | ||
this.children.push(new LexerNode(childElements[i], nextRegex, nextRegexes)); | ||
} | ||
for (var _i = 0, childElements_1 = childElements; _i < childElements_1.length; _i++) { | ||
var element = childElements_1[_i]; | ||
this.children.push(new LexerNode(element, nextRegex, nextRegexes)); | ||
} | ||
@@ -51,16 +50,14 @@ } | ||
for (var i = 0; i < this.children.length; i++) { | ||
if (this.children.hasOwnProperty(i)) { | ||
var child = this.children[i]; | ||
if (typeof child !== 'string' && typeof child.fillArray === 'function') { | ||
child.fillArray(array); | ||
} | ||
else if (re.unblank.test(child.toString())) { | ||
array.push(child.toString().trim()); | ||
} | ||
if (this.matches) { | ||
if (i < this.matches.length) { | ||
var match = this.matches[i]; | ||
if (re.unblank.test(match)) { | ||
array.push(match.trim()); | ||
} | ||
var child = this.children[i]; | ||
if (typeof child !== 'string' && typeof child.fillArray === 'function') { | ||
child.fillArray(array); | ||
} | ||
else if (re.unblank.test(child.toString())) { | ||
array.push(child.toString().trim()); | ||
} | ||
if (this.matches) { | ||
if (i < this.matches.length) { | ||
var match = this.matches[i]; | ||
if (re.unblank.test(match)) { | ||
array.push(match.trim()); | ||
} | ||
@@ -67,0 +64,0 @@ } |
@@ -9,9 +9,8 @@ /*! | ||
import { TagType } from './enums'; | ||
import { TaggedWord, TaggedSentense } from './types'; | ||
import { TaggedSentence, TaggedWord } from './types'; | ||
export declare class Tagger { | ||
constructor(); | ||
wordInLexicon(word: string): boolean; | ||
tag(words: string[]): TaggedSentense; | ||
tag(words: string[]): TaggedSentence; | ||
prettyPrint(taggedWords: TaggedWord[]): void; | ||
extendLexicon(lexicon: Record<string, TagType[]>): void; | ||
} |
@@ -42,9 +42,9 @@ "use strict"; | ||
} | ||
var _loop_1 = function (i_1) { | ||
var _loop_1 = function (i) { | ||
transformationRules.getRules().forEach(function (rule) { | ||
rule(taggedSentence, i_1); | ||
rule(taggedSentence, i); | ||
}); | ||
}; | ||
for (var i_1 = 0; i_1 < taggedSentence.length; i_1++) { | ||
_loop_1(i_1); | ||
for (var i = 0; i < taggedSentence.length; i++) { | ||
_loop_1(i); | ||
} | ||
@@ -60,3 +60,3 @@ return taggedSentence; | ||
for (var word in lexicon) { | ||
if (!Lexicon.hasOwnProperty(word)) { | ||
if (!Lexicon[word]) { | ||
Lexicon[word] = lexicon[word]; | ||
@@ -63,0 +63,0 @@ } |
@@ -0,3 +1,3 @@ | ||
export * from './Rule'; | ||
export * from './TaggedSentence'; | ||
export * from './TaggedWord'; | ||
export * from './TaggedSentence'; | ||
export * from './Rule'; |
@@ -13,4 +13,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./Rule"), exports); | ||
__exportStar(require("./TaggedSentence"), exports); | ||
__exportStar(require("./TaggedWord"), exports); | ||
__exportStar(require("./TaggedSentence"), exports); | ||
__exportStar(require("./Rule"), exports); |
@@ -1,2 +0,2 @@ | ||
import { TaggedSentense } from './TaggedSentence'; | ||
export declare type Rule = (taggedSentence: TaggedSentense, index: number) => void; | ||
import { TaggedSentence } from './TaggedSentence'; | ||
export declare type Rule = (taggedSentence: TaggedSentence, index: number) => void; |
import { TaggedWord } from './TaggedWord'; | ||
export declare type TaggedSentense = TaggedWord[]; | ||
export declare type TaggedSentence = TaggedWord[]; |
{ | ||
"name": "@devil7softwares/pos", | ||
"description": "FastTag part of speech tagger implementation", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": "Percy Wegmann", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
], | ||
"license": "LGPL", | ||
"license": "LGPL-3.0", | ||
"repository": { | ||
@@ -38,3 +38,3 @@ "type": "git", | ||
"build": "tsc", | ||
"lint": "eslint . --ext ts --fix", | ||
"lint": "eslint . --ext ts,tsx --fix", | ||
"format": "prettier -uw .", | ||
@@ -46,2 +46,9 @@ "test": "ts-mocha src/**/*.spec.ts" | ||
"@types/node": "^17.0.21", | ||
"@typescript-eslint/eslint-plugin": "^5.12.1", | ||
"@typescript-eslint/parser": "^5.12.1", | ||
"eslint": "^8.10.0", | ||
"eslint-config-prettier": "^8.4.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"mocha": "~9.2.1", | ||
@@ -48,0 +55,0 @@ "prettier": "^2.5.1", |
@@ -7,2 +7,5 @@ # POS ![build & test](https://github.com/Devil7-Softwares/pos-js/workflows/Build%20and%20Test/badge.svg) ![npm](https://img.shields.io/npm/v/@devil7softwares/pos) ![license](https://img.shields.io/npm/l/@devil7softwares/pos) ![min](https://img.shields.io/bundlephobia/min/@devil7softwares/pos) ![minzip](https://img.shields.io/bundlephobia/minzip/@devil7softwares/pos) | ||
## Demo | ||
[Click here](https://devil7-softwares.github.io/pos-js/) to check demo or checkout [samples](./samples) and [demo source](./demo). | ||
## Installation | ||
@@ -9,0 +12,0 @@ ```sh |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
2475718
26
0
93149
89
15