sort and filter collocations

This commit is contained in:
Luka Kavčič 2020-08-25 16:24:11 +02:00
parent 04c8bc1471
commit 8802a09c9c
2 changed files with 6 additions and 3 deletions

View File

@ -30,7 +30,7 @@ all: build
build: copy $(CSS_FILE) bundle.js local.js build: copy $(CSS_FILE) bundle.js local.js
transcrypt: $(RES_PY_FILE) $(TS_BUILD) transcrypt: $(RES_PY_FILE) $(TS_BUILD)
transcrypt $(TS_FLAGS) $< python3 -m transcrypt $(TS_FLAGS) $<
bundle.js: transcrypt $(CONV_FILE) bundle.js: transcrypt $(CONV_FILE)
cd ..; browserify $(BR_FLAGS) build/$(TS_BUILD)/main.js -o build/bundle.js cd ..; browserify $(BR_FLAGS) build/$(TS_BUILD)/main.js -o build/bundle.js

View File

@ -144,6 +144,9 @@ class SkeModal(ClickMessage):
if not data[0].gf2_check and type(data[0]) is SkeExample: if not data[0].gf2_check and type(data[0]) is SkeExample:
# we get the data, we have to match it with available data on our gf2 examples API # we get the data, we have to match it with available data on our gf2 examples API
match_gf2_examples(data, page_num, search_term, ske_index) match_gf2_examples(data, page_num, search_term, ske_index)
elif type(data[0]) is SkeCollocation:
data.sort(key= lambda x: x.structure_name)
data = [x for x in data if x.structure_name is not "N/A"]
model.modal_set(lambda: modals.ske_list( model.modal_set(lambda: modals.ske_list(
search_term, data, page_num, model.entry.senses, model.ske.request_kinds)) search_term, data, page_num, model.entry.senses, model.ske.request_kinds))
@ -238,7 +241,7 @@ class SkeInsert(DataChgClickMessage):
lex_mid = ComponentLexeme() lex_mid = ComponentLexeme()
lex_mid.text = example["mid"] lex_mid.text = example["mid"]
lex_mid.role = "collocation" lex_mid.role = "headword"
lex_right = ComponentLexeme() lex_right = ComponentLexeme()
lex_right.text = example["right"] lex_right.text = example["right"]
@ -263,7 +266,7 @@ class SkeInsert(DataChgClickMessage):
lex_mid = ComponentLexeme() lex_mid = ComponentLexeme()
lex_mid.text = example.word lex_mid.text = example.word
lex_mid.role = "collocation" lex_mid.role = "collocate"
lex_right = ComponentLexeme() lex_right = ComponentLexeme()
lex_right.text = "" lex_right.text = ""