diff options
author | Patrick Simianer <patrick@lilt.com> | 2019-12-24 09:43:56 +0000 |
---|---|---|
committer | Patrick Simianer <patrick@lilt.com> | 2019-12-24 09:43:56 +0000 |
commit | b76bedcec1750586b88536203090c22d97dd64e7 (patch) | |
tree | 93c27d0dbd0f45f68692869d67d6059b2453cafc /biuniq | |
parent | a4c4b61203c22c1aea71800466d157d79013070e (diff) | |
parent | d6ad8327a873043ba01aeb226dabd3a8716f82ae (diff) |
Merge branch 'master' of ssh://github.com/pks/nlp_scripts
Diffstat (limited to 'biuniq')
-rwxr-xr-x | biuniq | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#!/usr/bin/env ruby + +require 'zipf' + +f1 = ReadFile.new ARGV[0] +f2 = ReadFile.new ARGV[1] + +d1 = {} +d2 = {} +a1 = [] +a2 = [] + +while line1 = f1.gets + line1.strip! + + line2 = f2.gets + line2.strip! + + if !d1.include? line1 and !d2.include? line2 + a1 << line1 + a2 << line2 + end + + d1[line1] = true + d1[line2] = true +end + +o1 = WriteFile.new ARGV[0]+".out" +o2 = WriteFile.new ARGV[1]+".out" + +a1.each_with_index { |line1,i| + o1.write line1 + "\n" + o2.write a2[i] + "\n" +} + |