Skip to content

Commit

Permalink
Added coref to ./ask
Browse files Browse the repository at this point in the history
  • Loading branch information
ryhan committed Apr 16, 2013
1 parent a5de4e8 commit ecb7fad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ nosetests.xml
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.pydevproject

*.parse
*.osent
*.sst
8 changes: 7 additions & 1 deletion ask
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@

# Useful tools which should be pre-installed
import os, sys, errno
import subprocess
import re
import itertools
import nltk
from nltk.stem import PorterStemmer
import bs4

# Import our modules from /modules
sys.path.append("modules")
import questionContentSelector
import questionFromSentence
import coref

if __name__ == '__main__':
path_to_article = sys.argv[1]
num_questions = int(sys.argv[2])
# print("Generating " + str(num_questions) + " questions:")

# Pre-process article content.
article_content = open(path_to_article).read()
#article_content = open(path_to_article).read()
#print (article_content)
article_content = coref.process(path_to_article)

# Should probably apply co-reference resolution to article content here.

Expand Down
3 changes: 2 additions & 1 deletion modules/questionFromSentence.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def transform(sentence):
tokens = nltk.word_tokenize(sentence)
posTag = nltk.pos_tag([tokens[0]])[0]

add_why = (random.randint(0,1) == 1)
#add_why = (random.randint(0,1) == 1)
add_why = 0

#if (tokens[1].upper() in BEING and posTag == 'PRP'):
if (len(tokens) > 1 and tokens[1].upper() in BEING):
Expand Down

0 comments on commit ecb7fad

Please sign in to comment.