/
scratch.js
98 lines (78 loc) · 2.65 KB
/
scratch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* eslint-disable no-console, no-unused-vars */
import nlp from './src/three.js'
// import plg from './plugins/paragraphs/src/plugin.js'
// nlp.plugin(plg)
let txt = ''
// let doc
// let m
// nlp.verbose('tagger')
// let doc = nlp('When Dona Valeria finds out that Fernando Jose is in a relationship, she gets mad at her son for dating someone beneath their social status')
// doc.compute('coreference')
// bug 3
// let doc = nlp("Dr. John Smith-McDonald?")
// // let doc = nlp("Petsmart application? ")
// let opts = {
// keepPunct: false,
// punctuation: 'none',
// // abbreviations: false,
// case: false,
// }
// console.log(doc.match('McDonald').text('machine') + '|')
let arr = [
// "keep a cool head",
"petsmart application?",
// "attacked by a bear?",
// "Gal's DIARY: He ws quiet 2dy.",
// "All right relax.",
// "HP to be self-sufficient by 2010",
// "the woman isn't dead.",
]
arr.forEach(str => {
let doc = nlp(str)
doc.nouns().toPlural()
console.log(doc.text())
})
// let doc = nlp("petsmart application?")
// let m = doc.match('application')
// console.log(doc.text({ punctuation: false }))
// nlp('two turtledoves and a partridge in a pear tree').nouns().isSingular().out('array')
// let doc = nlp('hello there after words')
// let regs = doc.match('(after|words)+').docs[0].map(t => {
// return { id: t.id, optional: true }
// })
// let m = doc.match('hello there')
// console.log(m.json({ sentence: true }))
// m.growRight(regs).debug()
// console.log(doc.replaceWith('a hoy hoy').text())
// let doc = nlp('hello there')
// console.log(doc.replaceWith('a hoy hoy').text())
// nlp.world().model.one.prefixes.semi = true
// nlp('semi-detatched').debug()
// let world = nlp.world()
// world.model.one.prePunctuation.push('~')
// console.log(nlp.world().model.one.prePunctuation)
// console.log(nlp('~sorta').docs)
// nlp('~sorta').match('sorta').debug()
arr = [
// `If you notice swelling`,
// `and whisk to fully incorporate`,
// `Going shopping alone`,
// `when the killer strikes`,
// `Your refusal may cause hurt and disappointment`,
// 'Carpenter\'s one year of coaching',
// `Holly objects to Nia's character`,
// ' visa & travel assistance',
// 'Let the dishwasher run for an entire cycle',
// 'by encouraging carpooling',
// 'Ohio beaver trapping season starts in late December ',
// 'We Personally Guarantee Everything We Sell',
// 'we personally guarantee',
// // 'unless we win',
// // 'and we offer',
// "method for measuring",
// "responsibility for setting",
// "Attack and resolve your issues",
]
txt = arr[0]
// let doc = nlp(txt).debug()
// doc.match('#Conjunction #Adjective #Noun').debug()