-
Notifications
You must be signed in to change notification settings - Fork 0
/
scratch.js
48 lines (43 loc) · 1.25 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
/* eslint-disable no-console, no-unused-vars */
import nlp from './src/index.js'
// nlp.verbose('tagger')
import one from '/Users/spencer/mountain/pt-compromise/data/models/plurals.js'
// let already = {}
// let tmp = one
// tmp = tmp.filter(a => {
// if (already[a[0]]) {
// return false
// }
// already[a[0]] = true
// return true
// })
// console.log(JSON.stringify(tmp, null, 2))
let str = ``
str = `cantar é bom`
str = `ele havia falado`
str = `nos temos ido`
str = `Tinham deixado aqui uma cadeira`
str = `Tinham deixado`
str = `18,9 milhões`
str = `18 milhões`
str = `será sorteado`
str = `Heróis do mar, nobre povo,`
str = `Entre as brumas da memória,`
str = `Desfralda a invicta Bandeira,`
str = `O Oceano, a rugir d'amor,`
str = 'mãezinhas'
str = 'pesadas'
str = 'odiado'
str = 'nós fomos'
str = 'as lindas flores cresciam rapidamente'
str = 'falado'
let doc = nlp(str).debug().compute('root')
console.log(doc.json()[0].terms)
// doc.match('#Determiner {linda} {flor} {crescer} #Adverb').debug()
// console.log(doc.nouns().toPlural().text())
// console.log(nlp('falado').verbs().conjugate()[0])
// console.log(doc.numbers().get())
// doc.numbers().add(2)
// doc.match('{ir}').debug()
// console.log(doc.verbs().conjugate()[0].Gerund)
// doc.debug()