Skip to content

Commit

Permalink
compress verb rules more (79k!!)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed May 2, 2015
1 parent 2b8c7fd commit d04494d
Show file tree
Hide file tree
Showing 8 changed files with 1,146 additions and 1,158 deletions.
1,104 changes: 549 additions & 555 deletions client_side/nlp.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client_side/nlp.min.js

Large diffs are not rendered by default.

104 changes: 54 additions & 50 deletions src/data/lexicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,54 +23,19 @@ var lexicon = (function() {
convertables = require("../parents/adjective/conjugate/convertables")
}
var main = {
//contractions that don't need splitting-open, grammatically
"don't": "VB",
"won't": "VB",
"what's": "VB", //somewhat ambiguous (what does|what are)
"where'd": "VBD",
"when'd": "VBD",
"how'd": "VBD",
"what'd": "VBD",

//foreign words
"etc": "FW",
"etc": "FW", //foreign words
"ie": "FW",

"there": "EX",

"higher": "JJR",
"larger": "JJR",
"better": "JJR",
"earlier": "JJR",
"biggest": "JJS",
"easier": "JJR",

//important verbs
"said": "VBD",
"says": "VBZ",
"has": "VB",
"more": "RBR",
"had": "VBD",
"been": "VBD",
"going": "VBG",
"being": "VBG",
"began": "VBD",
"came": "VBD",
"did": "VBD",
"sounds": "VBZ",
"went": "VBD",
"given": "VBN",
"known": "VBN",
"shown": "VBN",
"seen": "VBN",
"according": "VBG",
"means": "VBZ",
"born": "VBN",
"resulting": "VBG",
"developing": "VBG",
"yourself": "PRP",
"staining": "VBG",
"meant": "VBD"

"sounds": "VBZ"
}

var compact = {
Expand All @@ -97,6 +62,38 @@ var lexicon = (function() {
"not"
],

"VBD": [
"where'd",
"when'd",
"how'd",
"what'd",
"said",
"had",
"been",
"began",
"came",
"did",
"meant",
"went"
],

"VBN": [
"given",
"known",
"shown",
"seen",
"born",
],

"VBG": [
"going",
"being",
"according",
"resulting",
"developing",
"staining"
],

//copula
"CP": [
"is",
Expand Down Expand Up @@ -269,6 +266,7 @@ var lexicon = (function() {
"thou",
"il",
"elle",
"yourself",
"'em"
],

Expand Down Expand Up @@ -406,7 +404,7 @@ var lexicon = (function() {
}

//add values
keys=Object.keys(values)
keys = Object.keys(values)
l = keys.length
for (i = 0; i < l; i++) {
main[keys[i]] = "CD"
Expand Down Expand Up @@ -456,16 +454,16 @@ var lexicon = (function() {
//add irregular verbs
l = verb_irregulars.length;
for (i = 0; i < l; i++) {
c=verb_irregulars[i]
main[c.infinitive]=main[c.infinitive]||"VBP"
main[c.gerund]=main[c.gerund]||"VBG"
main[c.past]=main[c.past]||"VBD"
main[c.present]=main[c.present]||"VBZ"
c = verb_irregulars[i]
main[c.infinitive] = main[c.infinitive] || "VBP"
main[c.gerund] = main[c.gerund] || "VBG"
main[c.past] = main[c.past] || "VBD"
main[c.present] = main[c.present] || "VBZ"
if (c.doer) {
main[c.doer]=main[c.doer]||"NNA"
main[c.doer] = main[c.doer] || "NNA"
}
if (c.participle) {
main[c.future]=main[c.future]||"VB"
main[c.future] = main[c.future] || "VB"
}
}

Expand All @@ -476,7 +474,7 @@ var lexicon = (function() {
for (i = 0; i < l; i++) {
main[adjectives[i]] = "JJ"
}
keys=Object.keys(convertables)
keys = Object.keys(convertables)
l = keys.length;
for (i = 0; i < l; i++) {
j = keys[i]
Expand Down Expand Up @@ -515,7 +513,13 @@ var lexicon = (function() {
// console.log(lexicon[null]===undefined)
// console.log(lexicon["dr"]==="NNAB")
// console.log(lexicon["hope"]==="NN")
// console.log(lexicon["higher"]==="JJR")
// console.log(lexicon["earlier"]==="JJR")
// console.log(lexicon["larger"]==="JJR")
// console.log(lexicon["says"]==="VBZ")
// console.log(lexicon["sounds"]==="VBZ")
// console.log(lexicon["means"]==="VBZ")

// console.log(Object.keys(lexicon).length)
// console.log(lexicon['prettier']=="JJR")
// console.log(lexicon['prettiest']=="JJS")
// console.log(Object.keys(lexicon).length)
// console.log(lexicon['prettier']=="JJR")
// console.log(lexicon['prettiest']=="JJS")
17 changes: 0 additions & 17 deletions src/data/lexicon/uncountables.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ var uncountables = (function() {
"tuna",
"trout",
"advice",
"help",
"information",
"knowledge",
"trouble",
"work",
"enjoyment",
"fun",
"recreation",
Expand Down Expand Up @@ -55,14 +53,12 @@ var uncountables = (function() {
"tennis",
"baggage",
"currency",
"travel",
"soap",
"toothpaste",
"food",
"sugar",
"butter",
"flour",
"progress",
"research",
"leather",
"wool",
Expand All @@ -74,14 +70,7 @@ var uncountables = (function() {
"silk",
"patience",
"impatience",
"talent",
"energy",
"experience",
"vinegar",
"polish",
"air",
"alcohol",
"anger",
"art",
"beef",
"blood",
Expand All @@ -91,8 +80,6 @@ var uncountables = (function() {
"chewing",
"conduct",
"confusion",
"courage",
"damage",
"education",
"electricity",
"entertainment",
Expand All @@ -104,16 +91,13 @@ var uncountables = (function() {
"happiness",
"history",
"honey",
"hope",
"hospitality",
"importance",
"jam",
"justice",
"laughter",
"leisure",
"lightning",
"literature",
"love",
"luck",
"melancholy",
"milk",
Expand Down Expand Up @@ -153,7 +137,6 @@ var uncountables = (function() {
"trousers",
"violence",
"warmth",
"washing",
"wine",
"steel",
"soccer",
Expand Down
7 changes: 6 additions & 1 deletion src/data/lexicon/verbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,12 @@ var verbs = (function() {
"measure",
"enhance",
"distinguish",
"avoid"
"avoid",
//contractions
"don't",
"won't",
"what's" //somewhat ambiguous (what does|what are)

]

if (typeof module !== "undefined" && module.exports) {
Expand Down
Loading

0 comments on commit d04494d

Please sign in to comment.