File tree 2 files changed +12
-11
lines changed
2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
1
# Language detection using a probabilistic algorithm
2
- # that checks for the presence of words with Bloom
2
+ # that checks for the presence of words with Bloom
3
3
# filters built from dictionaries for each language.
4
4
#
5
- # Original paper: Grothoff. 2007. A Quick Introduction to
6
- # Bloom Filters. Department of Computer Sciences, Purdue
5
+ # Original paper: Grothoff. 2007. A Quick Introduction to
6
+ # Bloom Filters. Department of Computer Sciences, Purdue
7
7
# University.
8
8
class Treat ::Workers ::Extractors ::Language ::WhatLanguage
9
9
@@ -35,7 +35,7 @@ def self.language(entity, options = {})
35
35
36
36
options = DefaultOptions . merge ( options )
37
37
38
- @@detector ||= ::WhatLanguage . new ( :possibilities )
38
+ @@detector ||= ::WhatLanguage . new ( :all )
39
39
possibilities = @@detector . process_text ( entity . to_s )
40
40
lang = { }
41
41
Original file line number Diff line number Diff line change @@ -434,14 +434,15 @@ module Treat::Specs::Entities
434
434
it "guesses the language of the entity" do
435
435
436
436
Treat . core . language . detect = true
437
- a = 'I want to know God\'s thoughts; the rest are details. - Albert Einstein'
438
- b = 'El mundo de hoy no tiene sentido, asi que por que deberia pintar cuadros que lo tuvieran? - Pablo Picasso'
439
- c = 'Un bon Allemand ne peut souffrir les Francais, mais il boit volontiers les vins de France. - Goethe'
440
- d = 'Wir haben die Kunst, damit wir nicht an der Wahrheit zugrunde gehen. - Friedrich Nietzsche'
437
+ a = 'I want to know God\'s thoughts; the rest are details.' # Albert Einstein
438
+ b = 'El mundo de hoy no tiene sentido, asi que por que deberia pintar cuadros que lo tuvieran?' # Pablo Picasso
439
+ c = 'Un bon Allemand ne peut souffrir les Francais, mais il boit volontiers les vins de France.' # Goethe
440
+ d = 'Wir haben die Kunst, damit wir nicht an der Wahrheit zugrunde gehen.' # Friedrich Nietzsche
441
+
441
442
a . language . should eql :english
442
- # b.language.should eql :spanish
443
- # c.language.should eql :french
444
- # d.language.should eql :german
443
+ b . language . should eql :spanish
444
+ c . language . should eql :french
445
+ d . language . should eql :german
445
446
446
447
# Reset default
447
448
Treat . core . language . detect = false
You can’t perform that action at this time.
0 commit comments