lvwerra HF staff commited on
Commit
0dffa42
1 Parent(s): 4ca1672

Update Space (evaluate main: d781f85c)

Browse files
Files changed (1) hide show
  1. word_length.py +11 -5
word_length.py CHANGED
@@ -12,10 +12,12 @@
12
  # See the License for the specific language governing permissions and
13
  # limitations under the License.
14
 
 
 
 
15
  from nltk import word_tokenize
 
16
  import evaluate
17
- import datasets
18
- from statistics import mean
19
 
20
 
21
  _DESCRIPTION = """
@@ -49,6 +51,7 @@ year={2020}
49
  }
50
  """
51
 
 
52
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
53
  class WordLength(evaluate.Measurement):
54
  """This measurement returns the average number of words in the input string(s)."""
@@ -62,13 +65,16 @@ class WordLength(evaluate.Measurement):
62
  citation=_CITATION,
63
  inputs_description=_KWARGS_DESCRIPTION,
64
  # This defines the format of each prediction and reference
65
- features=datasets.Features({
66
- 'data': datasets.Value('string'),
67
- })
 
 
68
  )
69
 
70
  def _download_and_prepare(self, dl_manager):
71
  import nltk
 
72
  nltk.download("punkt")
73
 
74
  def _compute(self, data, tokenizer=word_tokenize):
 
12
  # See the License for the specific language governing permissions and
13
  # limitations under the License.
14
 
15
+ from statistics import mean
16
+
17
+ import datasets
18
  from nltk import word_tokenize
19
+
20
  import evaluate
 
 
21
 
22
 
23
  _DESCRIPTION = """
 
51
  }
52
  """
53
 
54
+
55
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
56
  class WordLength(evaluate.Measurement):
57
  """This measurement returns the average number of words in the input string(s)."""
 
65
  citation=_CITATION,
66
  inputs_description=_KWARGS_DESCRIPTION,
67
  # This defines the format of each prediction and reference
68
+ features=datasets.Features(
69
+ {
70
+ "data": datasets.Value("string"),
71
+ }
72
+ ),
73
  )
74
 
75
  def _download_and_prepare(self, dl_manager):
76
  import nltk
77
+
78
  nltk.download("punkt")
79
 
80
  def _compute(self, data, tokenizer=word_tokenize):