diff options
| author | LV-426 <lv-426@taproot.org.il> | 2014-12-10 03:03:48 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-12-16 10:59:14 +0200 |
| commit | d67cb649f26259954d1cfeb0665f93d2059ed1cd (patch) | |
| tree | f92484c87d120a99ea84675c2e6a0d4d9ed3da75 /src/textanalysis.js | |
| parent | 23760b4ae30876e064788fb8060fc7987e3d29c4 (diff) | |
addLink: drop drop_conjugator_links param, extract apply_conjugator_link_logic()
Diffstat (limited to 'src/textanalysis.js')
| -rw-r--r-- | src/textanalysis.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/textanalysis.js b/src/textanalysis.js index 963628e6..fdc4e837 100644 --- a/src/textanalysis.js +++ b/src/textanalysis.js @@ -189,6 +189,12 @@ var textAnalyser = function (newtext, finalize) { ret.link_set_add.push(link); } + function apply_conjugator_link_logic(link, drop_conjugator_links){ + if (drop_conjugator_links && link.name && (link.name.replace(/ /g,"") === "and")) { + link.state = "temp"; + } + } + if (newtext.indexOf('#') == -1 || finalize) { lastnode = null; } @@ -396,11 +402,11 @@ var textAnalyser = function (newtext, finalize) { } ret.for_each_link_add(function (link) { + apply_conjugator_link_logic(link, ret.drop_conjugator_links); graph.addLinkByName(link.__src.name, link.__dst.name, link.name, - link.state, - ret.drop_conjugator_links); + link.state); }); } else { // REINITIALISE GRAPH (DUMB BUT IT WORKS) @@ -421,11 +427,11 @@ var textAnalyser = function (newtext, finalize) { ret.for_each_link_add(function (link) { if (false == finalize || link.name !== 'and') { + apply_conjugator_link_logic(link, ret.drop_conjugator_links); graph.addLinkByName(link.__src, link.__dst, link.name, - link.state, - ret.drop_conjugator_links); + link.state); } }); } |
