diff options
author | Avneesh Saluja <asaluja@gmail.com> | 2013-03-28 18:28:16 -0700 |
---|---|---|
committer | Avneesh Saluja <asaluja@gmail.com> | 2013-03-28 18:28:16 -0700 |
commit | 5b8253e0e1f1393a509fb9975ba8c1347af758ed (patch) | |
tree | 1790470b1d07a0b4973ebce19192e896566ea60b /python/tests/extractor/refmt.py | |
parent | 2389a5a8a43dda87c355579838559515b0428421 (diff) | |
parent | b203f8c5dc8cff1b9c9c2073832b248fcad0765a (diff) |
fixed conflicts
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])) |