summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2016-07-20 10:55:13 +0200
committerPatrick Simianer <p@simianer.de>2016-07-20 10:55:13 +0200
commitfac00976168c6b3c94d01d76babede147e4a0710 (patch)
tree208bf85241a7e02a51c8a538746eefde6faa244d
parent68fbe2a717f07cda33aa57668d01d8190dae9ede (diff)
noloo new rules: align all
-rwxr-xr-xphrase2_extraction/phrase2_extraction.rb10
-rwxr-xr-xserver.rb12
2 files changed, 21 insertions, 1 deletions
diff --git a/phrase2_extraction/phrase2_extraction.rb b/phrase2_extraction/phrase2_extraction.rb
index 1f268cd..b376953 100755
--- a/phrase2_extraction/phrase2_extraction.rb
+++ b/phrase2_extraction/phrase2_extraction.rb
@@ -178,6 +178,16 @@ class Rule
}
astr.strip!
+ #a = []
+ #source_string.strip.lstrip.split.each_with_index { |s,i|
+ # target_string.strip.lstrip.split.each_with_index { |t,j|
+ # if !s.match /\[X,\d+\]/ and !t.match /\[X,\d+\]/
+ # a << "#{i}-#{j}"
+ # end
+ # }
+ #}
+ #astr = a.join ' '
+
return "[X] ||| #{source_string} ||| #{target_string} ||| NewRule=1 ||| #{astr}"
end
diff --git a/server.rb b/server.rb
index 4a3e8f6..752d0d5 100755
--- a/server.rb
+++ b/server.rb
@@ -307,7 +307,17 @@ def process_next reply
}
tmp_rules_known = tmp_rules - tmp_rules_new
tmp_rules_known.each { |i| no_loo_known_rules << "[X] ||| #{i[0]} ||| #{i[1]} ||| KnownRule=1 ||| 0-0" }
- tmp_rules_new.each { |i| no_loo_new_rules << "[X] ||| #{i[0]} ||| #{i[1]} ||| NewRule=1 ||| 0-0" }
+ tmp_rules_new.each { |i|
+ a = []
+ i[0].strip.lstrip.split.each_with_index { |s,ii|
+ i[1].strip.lstrip.split.each_with_index { |t,j|
+ if !s.match /\[X,\d+\]/ and !t.match /\[X,\d+\]/
+ a << "#{ii}-#{j}"
+ end
+ }
+ }
+ no_loo_new_rules << "[X] ||| #{i[0]} ||| #{i[1]} ||| NewRule=1 ||| #{a.join ' '}"
+ }
end
# regular
new_rules = PhrasePhraseExtraction.extract_rules f, e, data["align"], true