sort and filter collocations

pull/8/head
Luka Kavčič 4 years ago
parent 04c8bc1471
commit 8802a09c9c

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

@ -144,6 +144,9 @@ class SkeModal(ClickMessage):
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
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(
search_term, data, page_num, model.entry.senses, model.ske.request_kinds))
@ -238,7 +241,7 @@ class SkeInsert(DataChgClickMessage):
lex_mid = ComponentLexeme()
lex_mid.text = example["mid"]
lex_mid.role = "collocation"
lex_mid.role = "headword"
lex_right = ComponentLexeme()
lex_right.text = example["right"]
@ -263,7 +266,7 @@ class SkeInsert(DataChgClickMessage):
lex_mid = ComponentLexeme()
lex_mid.text = example.word
lex_mid.role = "collocation"
lex_mid.role = "collocate"
lex_right = ComponentLexeme()
lex_right.text = ""

Loading…
Cancel
Save