Last active
January 15, 2023 09:03
-
-
Save khuyentran1401/7dda7f7ccc21c2e005190467a5ce4e6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from snorkel.labeling import labeling_function | |
# Give a meaningful name to each value | |
FAKE = 1 | |
REAL = 0 | |
ABSTAIN = -1 | |
@labeling_function() | |
def no_requirements(x: pd.Series): | |
return FAKE if x.requirements == "" else ABSTAIN | |
@labeling_function() | |
def requirements_less_than_10(x: pd.Series): | |
num_words = len(x.requirements.split(" ")) | |
return FAKE if num_words <= 10 else ABSTAIN | |
@labeling_function() | |
def requirements_less_than_20(x: pd.Series): | |
num_words = len(x.requirements.split(" ")) | |
return FAKE if num_words <= 20 else ABSTAIN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment