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

Fixed #9 (Preprocessors do not have access to the user_id and sentence) #10

Merged
merged 1 commit into from
Dec 12, 2018
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
2 changes: 1 addition & 1 deletion src/corporacreator/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _pre_process_corpus_data(self):
"/", expand=True
)[0] # TODO: Remove this line when the Gregor modifies the csv output to include user_id
preprocessor = getattr(preprocessors, self.locale.replace("-","")) # Get locale specific preprocessor
self.corpus_data["sentence"] = self.corpus_data["sentence"].apply(func=preprocessor)
self.corpus_data["sentence"] = self.corpus_data[["user_id", "sentence"]].apply(func=lambda arg: preprocessor(*arg), axis=1)

def _partition_corpus_data(self):
self.other = self.corpus_data.loc[
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/br.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def br(sentence):
def br(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/ca.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def ca(sentence):
def ca(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/cv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def cv(sentence):
def cv(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/cy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def cy(sentence):
def cy(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/de.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def de(sentence):
def de(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/en.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def en(sentence):
def en(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/fr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def fr(sentence):
def fr(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/gaIE.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def gaIE(sentence):
def gaIE(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/it.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def it(sentence):
def it(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/kab.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def kab(sentence):
def kab(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/ky.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def ky(sentence):
def ky(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/sl.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def sl(sentence):
def sl(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/tr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def tr(sentence):
def tr(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/tt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def tt(sentence):
def tt(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/corporacreator/preprocessors/zhTW.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
def zhTW(sentence):
def zhTW(user_id, sentence):
"""Cleans up the passed sentence, removing or reformatting invalid data.

Args:
user_id (str): User ID of sentence's speaker
sentence (str): Sentence to be cleaned up.

Returns:
Expand Down