-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #363 from nlp-compromise/dev
v10
- Loading branch information
Showing
103 changed files
with
3,522 additions
and
1,926 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"author": "Spencer Kelly <[email protected]> (http://spencermounta.in)", | ||
"name": "compromise", | ||
"description": "natural language processing in the browser", | ||
"version": "9.1.0", | ||
"version": "10.0.0", | ||
"main": "./builds/compromise.js", | ||
"repository": { | ||
"type": "git", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,14 @@ | ||
// 'use strict'; | ||
//this file is not included in the build. | ||
//use it for messing around. | ||
var nlp = require('./src/index'); | ||
// nlp.verbose('tagger'); | ||
// const corpus = require('nlp-corpus'); | ||
// let sotu = corpus.sotu.parsed()[23]; | ||
const fresh = require('./test/unit/lib/freshPrince.js'); | ||
const corpus = require('nlp-corpus'); | ||
let text = corpus.sotu.parsed()[0]; | ||
// const fresh = require('./test/unit/lib/freshPrince.js'); | ||
|
||
// bug.1 | ||
// .? vs * | ||
|
||
// nlp('is this').sentences(0).toNegative().debug(); | ||
// console.log(nlp('I\'m going to the shops').sentences().toPastTense().out()); | ||
|
||
// nlp('I\'m going to the shops').sentences().toPastTense().debug(); | ||
|
||
|
||
// let r = nlp.tokenize('5th - 7th').tag('NumberRange').debug(); | ||
// r.contractions().debug(); | ||
|
||
//===timer | ||
// console.time('parse'); | ||
// let r = nlp(fresh); | ||
// console.timeEnd('parse'); | ||
// | ||
// console.time('match'); | ||
// r.match('#Determiner (story|thing|#Adjective)', true); | ||
// console.timeEnd('match'); | ||
// | ||
// console.time('tag'); | ||
// r.tag('#Person'); | ||
// console.timeEnd('tag'); | ||
|
||
let str = 'hello there. I work for the F.B.I. in ft. Mede. hello there!'; | ||
let r = nlp(str); | ||
let o = r.sentences(1).out('offsets')[0]; | ||
console.log(o); | ||
console.log(str.substring(o.wordStart, o.wordEnd)); | ||
// r = nlp('he walks'); | ||
// r.match('walks').tag('Foo'); | ||
// r.verbs().toPastTense(); | ||
// r.debug(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
const fns = require('../fns'); | ||
|
||
// const colors = { | ||
// 'Person': '#6393b9', | ||
// 'Pronoun': '#81acce', | ||
// 'Noun': 'steelblue', | ||
// 'Verb': 'palevioletred', | ||
// 'Adverb': '#f39c73', | ||
// 'Adjective': '#b3d3c6', | ||
// 'Determiner': '#d3c0b3', | ||
// 'Preposition': '#9794a8', | ||
// 'Conjunction': '#c8c9cf', | ||
// 'Value': 'palegoldenrod', | ||
// 'Expression': '#b3d3c6' | ||
// }; | ||
|
||
const tag = (t, pos, reason) => { | ||
let title = t.normal || '[' + t.silent_term + ']'; | ||
title = fns.leftPad('\'' + title + '\'', 12); | ||
title += ' -> ' + pos; | ||
title += fns.rightPad((reason || ''), 15); | ||
console.log('%c' + title, ' color: #a2c99c'); | ||
}; | ||
const untag = (t, pos, reason) => { | ||
let title = t.normal || '[' + t.silent_term + ']'; | ||
title = fns.leftPad('\'' + title + '\'', 12); | ||
title += ' ~* ' + pos; | ||
title += ' ' + (reason || ''); | ||
console.log('%c' + title, ' color: #b66a6a'); | ||
}; | ||
module.exports = { | ||
tag: tag, | ||
untag: untag, | ||
}; |
Oops, something went wrong.