Skip to content

Commit 94254a8

Browse files
Renamed to word_count_classifier
1 parent d1952a4 commit 94254a8

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

classifiers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .lookup_lists import lookup_list
1111

1212
from .reference_quality import (
13-
text_length_classifier,
13+
word_count_classifier,
1414
chunked_sentence_complexity,
1515
)
1616

@@ -61,7 +61,7 @@
6161
workday_classifier,
6262
deberta_review_classifier,
6363
bert_sentiment_german,
64-
text_length_classifier,
64+
word_count_classifier,
6565
chunked_sentence_complexity,
6666
]:
6767
module_name = module.__name__.split(".")[-1]

classifiers/reference_quality/text_length_classifier/__init__.py renamed to classifiers/reference_quality/word_count_classifier/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from pydantic import BaseModel
2-
from textblob import TextBlob
32

43
INPUT_EXAMPLE = {"text": "This is too short!"}
54

65

7-
class TextLengthClassifierModel(BaseModel):
6+
class WordCountClassifierModel(BaseModel):
87
text: str
98

109
class Config:
1110
schema_extra = {"example": INPUT_EXAMPLE}
1211

1312

14-
def text_length_classifier(req: TextLengthClassifierModel):
13+
def word_count_classifier(req: WordCountClassifierModel):
1514
"""Checks the length of a string by counting the number of words in it"""
1615
words = req.text.split()
1716
length = len(words)

classifiers/reference_quality/text_length_classifier/code_snippet_common.md renamed to classifiers/reference_quality/word_count_classifier/code_snippet_common.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```python
2-
def text_length_classifier(text: str) -> str:
2+
def word_count_classifier(text: str) -> str:
33
"""
44
@param text: text to check the length of.
55
@return: either 'short', 'medium' or 'long' depending on the counted words.
@@ -20,7 +20,7 @@ def text_length_classifier(text: str) -> str:
2020
def example_integration():
2121
texts = ["This is short.", "This is a text with medium length.", "This is a longer text with many more words. There is even a second sentence with extra words. Splendid, what a joyful day!"]
2222
for text in texts:
23-
print(f"\"{text}\" is -> {text_length_classifier(text)}")
23+
print(f"\"{text}\" is -> {word_count_classifier(text)}")
2424

2525
example_integration()
2626
```

classifiers/reference_quality/text_length_classifier/code_snippet_refinery.md renamed to classifiers/reference_quality/word_count_classifier/code_snippet_refinery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
```python
22
ATTRIBUTE: str = "text" # only text attributes
33

4-
def text_length_classifier(record):
4+
def word_count_classifier(record):
55
words = record[ATTRIBUTE].text.split()
66
length = len(words)
77
if length < 5:

classifiers/reference_quality/text_length_classifier/config.py renamed to classifiers/reference_quality/word_count_classifier/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from util.configs import build_classifier_function_config
22
from util.enums import State, RefineryDataType, SelectionType, BricksVariableType
3-
from . import text_length_classifier, INPUT_EXAMPLE
3+
from . import word_count_classifier, INPUT_EXAMPLE
44

55

66
def get_config():
77
return build_classifier_function_config(
8-
function=text_length_classifier,
8+
function=word_count_classifier,
99
input_example=INPUT_EXAMPLE,
1010
issue_id=348,
1111
tabler_icon="RulerMeasure",
@@ -25,7 +25,7 @@ def get_config():
2525
},
2626
# bricks integrator information
2727
integrator_inputs={
28-
"name": "text_length_classifier",
28+
"name": "word_count_classifier",
2929
"refineryDataType": RefineryDataType.TEXT.value,
3030
"outputs": [
3131
"short",

0 commit comments

Comments
 (0)