コード例 #1
0
ファイル: classifiers.py プロジェクト: scraping-xx/TextBlob
 def _read_data(self, dataset, format=None):
     '''Reads a data file and returns and iterable that can be used
     as testing or training data.
     '''
     # Attempt to detect file format if "format" isn't specified
     if not format:
         format_class = formats.detect(dataset)
     else:
         if format not in formats.AVAILABLE.keys():
             raise ValueError("'{0}' format not supported.".format(format))
         format_class = formats.AVAILABLE[format]
     return format_class(dataset).to_iterable()
コード例 #2
0
ファイル: test_formats.py プロジェクト: LisaDawn/TextBlob
 def test_detect_json(self):
     format = formats.detect(JSON_FILE)
     assert_equal(format, formats.JSON)
コード例 #3
0
ファイル: test_formats.py プロジェクト: LisaDawn/TextBlob
 def test_detect_csv(self):
     format = formats.detect(CSV_FILE)
     assert_equal(format, formats.CSV)
コード例 #4
0
ファイル: test_formats.py プロジェクト: syllog1sm/TextBlob
 def test_detect_json(self):
     format = formats.detect(JSON_FILE)
     assert_equal(format, formats.JSON)
コード例 #5
0
ファイル: test_formats.py プロジェクト: syllog1sm/TextBlob
 def test_detect_csv(self):
     format = formats.detect(CSV_FILE)
     assert_equal(format, formats.CSV)