Skip to content

Commit

Permalink
<restore> token list formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kirianguiller committed Nov 13, 2020
1 parent 5df19b9 commit 24d3397
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/klang/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get(self) :
return ConllService.get_all()


@api.route("/conll/<string:conll_name>")
@api.route("/conlls/<string:conll_name>")
class ConllNameServiceResource(Resource):
"ConllService"

Expand Down
17 changes: 10 additions & 7 deletions app/klang/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,20 @@ def seperate_conll_sentences(conll_string: str) -> List[str]:

@staticmethod
def sentence_to_audio_tokens(sentence_string: str):
audio_tokens = {}
# audio_tokens = {}
audio_tokens = []
for line in sentence_string.split("\n"):
if line:
if not line.startswith("#"):
m = align_begin_and_end_regex.search(line)
audio_token = {
"token": m.group(1),
"alignBegin": int(m.group(2)),
"alignEnd": int(m.group(3)),
}
audio_tokens[int(line.split("\t")[0])] = audio_token
# audio_token = {
# "token": m.group(1),
# "alignBegin": int(m.group(2)),
# "alignEnd": int(m.group(3)),
# }
audio_token = [m.group(1), m.group(2), m.group(3)]
audio_tokens.append(audio_token)
# audio_tokens[int(line.split("\t")[0])] = audio_token

print(audio_tokens)
return audio_tokens
Expand Down
7 changes: 1 addition & 6 deletions app/utils/grew_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def get_samples(project_id : str):
return grew_samples

@staticmethod
<<<<<<< HEAD
def create_sample(project_id: str, sample_id: str):
reply = grew_request(
"newSample",
Expand All @@ -133,10 +132,7 @@ def delete_sample(project_id: str, sample_id: str) -> None:
data={"project_id": project_id, "sample_id": sample_id},
)


# @staticmethod
# def save_tree()
=======
@staticmethod
def search_pattern_in_graphs(project_id: str, pattern: str, user_ids = []):
if current_app.config["ENV"] == "prod":
data = {
Expand All @@ -151,4 +147,3 @@ def search_pattern_in_graphs(project_id: str, pattern: str, user_ids = []):
}
reply = grew_request("searchPatternInGraphs", data=data)
return reply
>>>>>>> origin/main

0 comments on commit 24d3397

Please sign in to comment.