Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug in sequence_tagging_for_ner #170

Merged
merged 1 commit into from
Jul 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sequence_tagging_for_ner/data/download.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
wget http://cs224d.stanford.edu/assignment2/assignment2.zip
if [ -f assignment2.zip ]; then
echo "data exist"
else
wget http://cs224d.stanford.edu/assignment2/assignment2.zip
fi

if [ $? -eq 0 ];then
unzip assignment2.zip
Expand Down
4 changes: 2 additions & 2 deletions sequence_tagging_for_ner/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def canonicalize_word(word, wordset=None, digits=True):
if (wordset != None) and (word in wordset): return word
word = canonicalize_digits(word) # try to canonicalize numbers
if (wordset == None) or (word in wordset): return word
else: return "<UNK>" # unknown token
else: return "UUUNKKK" # unknown token


def data_reader(data_file, word_dict, label_dict):
Expand All @@ -35,7 +35,7 @@ def data_reader(data_file, word_dict, label_dict):
"""

def reader():
UNK_IDX = word_dict["<UNK>"]
UNK_IDX = word_dict["UUUNKKK"]

sentence = []
labels = []
Expand Down
3 changes: 2 additions & 1 deletion sequence_tagging_for_ner/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ def event_handler(event):
test_data_file="data/test",
vocab_file="data/vocab.txt",
target_file="data/target.txt",
emb_file="data/wordVectors.txt")
emb_file="data/wordVectors.txt",
model_save_dir="model/")