Skip to content

Instantly share code, notes, and snippets.

@bambooforest
Created August 23, 2017 17:36
Show Gist options
  • Save bambooforest/778a890b5dc6e14284fd490fbdbdf262 to your computer and use it in GitHub Desktop.
Save bambooforest/778a890b5dc6e14284fd490fbdbdf262 to your computer and use it in GitHub Desktop.
skip or not skip words in acqdiv pipeline
w_ids = []
for w in words:
if w:
w.update(corpus=self.corpus, language=self.language)
w_id, = insert_word(session_id_fk=s_id, utterance_id_fk=u_id, **w).inserted_primary_key
else:
w_id = None
w_ids.append(w_id)
link_to_word = len(morphemes) == len(words) and None not in w_ids
##
w_ids = []
for w in words:
if w:
w.update(corpus=self.corpus, language=self.language)
w_id, = insert_word(session_id_fk=s_id, utterance_id_fk=u_id, **w).inserted_primary_key
w_ids.append(w_id)
link_to_word = len(morphemes) == len(w_ids)
##
w_ids = [insert_word(session_id_fk=s_id, utterance_id_fk=u_id, **w).inserted_primary_key[0]
for w in w if w]
link_to_word = len(morphemes) == len(w_ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment