Skip to content

Instantly share code, notes, and snippets.

@minhlab
Created September 19, 2017 14:18
Show Gist options
  • Save minhlab/d5e514472c03a60c5b0a21188509050d to your computer and use it in GitHub Desktop.
Save minhlab/d5e514472c03a60c5b0a21188509050d to your computer and use it in GitHub Desktop.
import os
import re
num_sg = 0
num_files = 0
for root, _, fnames in os.walk('.'):
for fname in fnames:
if '.parse' in fname:
with open(os.path.join(root, fname)) as f:
s = f.read()
num_sg += len(re.findall(r'\(\s*SG\b', s))
num_files += 1
print('Examined %d files' %num_files)
print('Found %d instances of SG' %num_sg)
@minhlab
Copy link
Author

minhlab commented Sep 19, 2017

On OntoNotes:

$ python count_sg.py
Examined 13108 files
Found 0 instances of SG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment