diff options
author | Chris Dyer <cdyer@Chriss-MacBook-Air.local> | 2013-01-08 15:45:06 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@Chriss-MacBook-Air.local> | 2013-01-08 15:45:06 -0500 |
commit | 0fef781b2374bc98fe38d32238220e4322ba708c (patch) | |
tree | d8d82d4588bb027b0fe8edc95e360b290c90a09d /python/tests/extractor/refmt.py | |
parent | 2538c4052e844ebf6f5615becd087f2d6658c587 (diff) | |
parent | f10edb43ceaca8284282707097aaaebb6c1aedde (diff) |
don't know
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'python/tests/extractor/refmt.py')
-rwxr-xr-x | python/tests/extractor/refmt.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/python/tests/extractor/refmt.py b/python/tests/extractor/refmt.py new file mode 100755 index 00000000..437d5b7a --- /dev/null +++ b/python/tests/extractor/refmt.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import collections, sys + +lines = [] +f = collections.defaultdict(int) +fe = collections.defaultdict(lambda: collections.defaultdict(int)) + +for line in sys.stdin: + tok = [x.strip() for x in line.split('|||')] + count = int(tok[4]) + f[tok[1]] += count + fe[tok[1]][tok[2]] += count + lines.append(tok) + +for tok in lines: + feat = 'IsSingletonF={0}.0 IsSingletonFE={1}.0'.format( + 0 if f[tok[1]] > 1 else 1, + 0 if fe[tok[1]][tok[2]] > 1 else 1) + print ' ||| '.join((tok[0], tok[1], tok[2], feat, tok[3])) |