whatlanguage 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/copyright-en DELETED
@@ -1,243 +0,0 @@
1
- The english word list in `wordlists/english` is compiled from a preexisting word list
2
- (public domain) in this repository and the word list from SCOWL 7.0. To comply with the
3
- license of Kevin Atkinson's work, his copyright file is attached below.
4
-
5
- ------------------------------------------------------------------------
6
-
7
- This English word list is comes directly from SCOWL 7.0 (up to level 60,
8
- using the speller/make-aspell-dict script, http://wordlist.sourceforge.net/)
9
- and is thus under the same copyright of SCOWL. The affix file (only
10
- included in the aspell6 package) is based on the Ispell one which is
11
- under the same copyright of Ispell. Part of SCOWL is also based on
12
- Ispell thus the Ispell copyright is included with the SCOWL copyright.
13
-
14
- The collective work is Copyright 2000-2011 by Kevin Atkinson as well
15
- as any of the copyrights mentioned below:
16
-
17
- Copyright 2000-2011 by Kevin Atkinson
18
-
19
- Permission to use, copy, modify, distribute and sell these word
20
- lists, the associated scripts, the output created from the scripts,
21
- and its documentation for any purpose is hereby granted without fee,
22
- provided that the above copyright notice appears in all copies and
23
- that both that copyright notice and this permission notice appear in
24
- supporting documentation. Kevin Atkinson makes no representations
25
- about the suitability of this array for any purpose. It is provided
26
- "as is" without express or implied warranty.
27
-
28
- Alan Beale <biljir@pobox.com> also deserves special credit as he has,
29
- in addition to providing the 12Dicts package and being a major
30
- contributor to the ENABLE word list, given me an incredible amount of
31
- feedback and created a number of special lists (those found in the
32
- Supplement) in order to help improve the overall quality of SCOWL.
33
-
34
- The 10 level includes the 1000 most common English words (according to
35
- the Moby (TM) Words II [MWords] package), a subset of the 1000 most
36
- common words on the Internet (again, according to Moby Words II), and
37
- frequently class 16 from Brian Kelk's "UK English Wordlist
38
- with Frequency Classification".
39
-
40
- The MWords package was explicitly placed in the public domain:
41
-
42
- The Moby lexicon project is complete and has
43
- been place into the public domain. Use, sell,
44
- rework, excerpt and use in any way on any platform.
45
-
46
- Placing this material on internal or public servers is
47
- also encouraged. The compiler is not aware of any
48
- export restrictions so freely distribute world-wide.
49
-
50
- You can verify the public domain status by contacting
51
-
52
- Grady Ward
53
- 3449 Martha Ct.
54
- Arcata, CA 95521-4884
55
-
56
- grady@netcom.com
57
- grady@northcoast.com
58
-
59
- The "UK English Wordlist With Frequency Classification" is also in the
60
- Public Domain:
61
-
62
- Date: Sat, 08 Jul 2000 20:27:21 +0100
63
- From: Brian Kelk <Brian.Kelk@cl.cam.ac.uk>
64
-
65
- > I was wondering what the copyright status of your "UK English
66
- > Wordlist With Frequency Classification" word list as it seems to
67
- > be lacking any copyright notice.
68
-
69
- There were many many sources in total, but any text marked
70
- "copyright" was avoided. Locally-written documentation was one
71
- source. An earlier version of the list resided in a filespace called
72
- PUBLIC on the University mainframe, because it was considered public
73
- domain.
74
-
75
- Date: Tue, 11 Jul 2000 19:31:34 +0100
76
-
77
- > So are you saying your word list is also in the public domain?
78
-
79
- That is the intention.
80
-
81
- The 20 level includes frequency classes 7-15 from Brian's word list.
82
-
83
- The 35 level includes frequency classes 2-6 and words appearing in at
84
- least 11 of 12 dictionaries as indicated in the 12Dicts package. All
85
- words from the 12Dicts package have had likely inflections added via
86
- my inflection database.
87
-
88
- The 12Dicts package and Supplement is in the Public Domain.
89
-
90
- The WordNet database, which was used in the creation of the
91
- Inflections database, is under the following copyright:
92
-
93
- This software and database is being provided to you, the LICENSEE,
94
- by Princeton University under the following license. By obtaining,
95
- using and/or copying this software and database, you agree that you
96
- have read, understood, and will comply with these terms and
97
- conditions.:
98
-
99
- Permission to use, copy, modify and distribute this software and
100
- database and its documentation for any purpose and without fee or
101
- royalty is hereby granted, provided that you agree to comply with
102
- the following copyright notice and statements, including the
103
- disclaimer, and that the same appear on ALL copies of the software,
104
- database and documentation, including modifications that you make
105
- for internal use or for distribution.
106
-
107
- WordNet 1.6 Copyright 1997 by Princeton University. All rights
108
- reserved.
109
-
110
- THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON
111
- UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
112
- IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON
113
- UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT-
114
- ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE
115
- LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY
116
- THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
117
-
118
- The name of Princeton University or Princeton may not be used in
119
- advertising or publicity pertaining to distribution of the software
120
- and/or database. Title to copyright in this software, database and
121
- any associated documentation shall at all times remain with
122
- Princeton University and LICENSEE agrees to preserve same.
123
-
124
- The 40 level includes words from Alan's 3esl list found in version 4.0
125
- of his 12dicts package. Like his other stuff the 3esl list is also in the
126
- public domain.
127
-
128
- The 50 level includes Brian's frequency class 1, words words appearing
129
- in at least 5 of 12 of the dictionaries as indicated in the 12Dicts
130
- package, and uppercase words in at least 4 of the previous 12
131
- dictionaries. A decent number of proper names is also included: The
132
- top 1000 male, female, and Last names from the 1990 Census report; a
133
- list of names sent to me by Alan Beale; and a few names that I added
134
- myself. Finally a small list of abbreviations not commonly found in
135
- other word lists is included.
136
-
137
- The name files form the Census report is a government document which I
138
- don't think can be copyrighted.
139
-
140
- The file special-jargon.50 uses common.lst and word.lst from the
141
- "Unofficial Jargon File Word Lists" which is derived from "The Jargon
142
- File". All of which is in the Public Domain. This file also contain
143
- a few extra UNIX terms which are found in the file "unix-terms" in the
144
- special/ directory.
145
-
146
- The 55 level includes words from Alan's 2of4brif list found in version
147
- 4.0 of his 12dicts package. Like his other stuff the 2of4brif is also
148
- in the public domain.
149
-
150
- The 60 level includes all words appearing in at least 2 of the 12
151
- dictionaries as indicated by the 12Dicts package.
152
-
153
- The 70 level includes Brian's frequency class 0 and the 74,550 common
154
- dictionary words from the MWords package. The common dictionary words,
155
- like those from the 12Dicts package, have had all likely inflections
156
- added. The 70 level also included the 5desk list from version 4.0 of
157
- the 12Dics package which is the public domain.
158
-
159
- The 80 level includes the ENABLE word list, all the lists in the
160
- ENABLE supplement package (except for ABLE), the "UK Advanced Cryptics
161
- Dictionary" (UKACD), the list of signature words in from YAWL package,
162
- and the 10,196 places list from the MWords package.
163
-
164
- The ENABLE package, mainted by M\Cooper <thegrendel@theriver.com>,
165
- is in the Public Domain:
166
-
167
- The ENABLE master word list, WORD.LST, is herewith formally released
168
- into the Public Domain. Anyone is free to use it or distribute it in
169
- any manner they see fit. No fee or registration is required for its
170
- use nor are "contributions" solicited (if you feel you absolutely
171
- must contribute something for your own peace of mind, the authors of
172
- the ENABLE list ask that you make a donation on their behalf to your
173
- favorite charity). This word list is our gift to the Scrabble
174
- community, as an alternate to "official" word lists. Game designers
175
- may feel free to incorporate the WORD.LST into their games. Please
176
- mention the source and credit us as originators of the list. Note
177
- that if you, as a game designer, use the WORD.LST in your product,
178
- you may still copyright and protect your product, but you may *not*
179
- legally copyright or in any way restrict redistribution of the
180
- WORD.LST portion of your product. This *may* under law restrict your
181
- rights to restrict your users' rights, but that is only fair.
182
-
183
- UKACD, by J Ross Beresford <ross@bryson.demon.co.uk>, is under the
184
- following copyright:
185
-
186
- Copyright (c) J Ross Beresford 1993-1999. All Rights Reserved.
187
-
188
- The following restriction is placed on the use of this publication:
189
- if The UK Advanced Cryptics Dictionary is used in a software package
190
- or redistributed in any form, the copyright notice must be
191
- prominently displayed and the text of this document must be included
192
- verbatim.
193
-
194
- There are no other restrictions: I would like to see the list
195
- distributed as widely as possible.
196
-
197
- The 95 level includes the 354,984 single words, 256,772 compound
198
- words, 4,946 female names and the 3,897 male names, and 21,986 names
199
- from the MWords package, ABLE.LST from the ENABLE Supplement, and some
200
- additional words found in my part-of-speech database that were not
201
- found anywhere else.
202
-
203
- Accent information was taken from UKACD.
204
-
205
- My VARCON package was used to create the American, British, and
206
- Canadian word list.
207
-
208
- Since the original word lists used used in the VARCON package came
209
- from the Ispell distribution they are under the Ispell copyright:
210
-
211
- Copyright 1993, Geoff Kuenning, Granada Hills, CA
212
- All rights reserved.
213
-
214
- Redistribution and use in source and binary forms, with or without
215
- modification, are permitted provided that the following conditions
216
- are met:
217
-
218
- 1. Redistributions of source code must retain the above copyright
219
- notice, this list of conditions and the following disclaimer.
220
- 2. Redistributions in binary form must reproduce the above copyright
221
- notice, this list of conditions and the following disclaimer in the
222
- documentation and/or other materials provided with the distribution.
223
- 3. All modifications to the source code must be clearly marked as
224
- such. Binary redistributions based on modified source code
225
- must be clearly marked as modified versions in the documentation
226
- and/or other materials provided with the distribution.
227
- (clause 4 removed with permission from Geoff Kuenning)
228
- 5. The name of Geoff Kuenning may not be used to endorse or promote
229
- products derived from this software without specific prior
230
- written permission.
231
-
232
- THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS
233
- IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
234
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
235
- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GEOFF
236
- KUENNING OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
237
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
238
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
239
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
240
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
241
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
242
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
243
- POSSIBILITY OF SUCH DAMAGE.
data/example.rb DELETED
@@ -1,51 +0,0 @@
1
- require 'lib/whatlanguage'
2
- require 'benchmark'
3
-
4
- texts = []
5
-
6
- texts << %q{Deux autres personnes ont été arrêtées durant la nuit. "Induite par le quinquennat, la modernisation de nos institutions (...) est un facteur de modernité et d'efficacité", a déclaré François Fillon. "Devant cet exécutif plus resserré et plus efficace, les pouvoirs du Parlement doivent être renforcés", a-t-il ajouté, en évoquant par exemple le contrôle parlementaire des nominations à "certains postes publics."
7
-
8
- Le premier ministre, indiquant que le président Nicolas Sarkozy entendait "réunir une commission réunissant des personnalités incontestables pour leurs compétences et représentatives de notre diversité politique qui sera chargée d'éclairer ses choix" en matière de modernisation des institutions.
9
-
10
- "Faut-il faire élire quelques députés au scrutin proportionnel? (...) Aucun sujet ne doit être tabou", a-t-il lâché. "Enfin nous devrons engager, comme le demande le Conseil constitutionnel, une révision de la carte des circonscriptions législatives. Ce travail sera engagé dans la transparence et en y associant l'opposition".}
11
-
12
- texts << %q{The links between the attempted car bombings in Glasgow and London are becoming clearer. Seven are believed to be doctors or medical students, while one formerly worked as a laboratory technician.
13
-
14
- Australian media have identified a man arrested at Brisbane airport as Dr Mohammed Haneef, 27.
15
-
16
- Two men have been arrested in Blackburn under terror laws but police have not confirmed a link with the car bombs.
17
-
18
- The pair were detained on an industrial estate and are being held at a police station in Lancashire on suspicion of offences under the Terrorism Act 2000.
19
-
20
- Thousands of passengers travelling from Heathrow Airport's Terminal 4 face major delays after a suspect bag sparked a security alert.
21
-
22
- BAA said the departure lounge was partially evacuated and departing passengers were being re-screened, causing some cancellations and delays.}
23
-
24
- texts << %q{En estado de máxima alertaen su nivel de crítico. Cinco detenciones hasta el momento parecen indicar que los coches bomba de Londres y Glasgow fueron obra de una misma célula de terroristas islámicos con residencia en el Reino Unido, posiblemente con alguna conexión con otros grupos previamente desarticulados. La relación con éstos, singularmente con el núcleo de Dhiren Barot (condenado a 30 años por sus planes de llenar limusinas con bombonas de gas para provocar una masiva explosión), podría haber llevado a su detención tiempo atrás y su puesta en libertad al no existir suficientes pruebas contra ellos.}
25
-
26
- texts << %q{Fern- und Regionalzüge, aber auch die S-Bahnen in den Großstädten stehen still. Gerade hat die Kanzlerin die Ergebnisse des Energiegipfels mit der Wirtschaft, den Energieerzeugern und Verbraucherschützern referiert, die "sachliche Atmosphäre" gelobt. Da wird der Umweltminister von einem Journalisten an seinen Ausspruch vom "Wirtschaftsstalinisten" erinnert, mit dem er jüngst den BASF-Vorstandschef Jürgen Hambrecht belegt hat im Streit um die ehrgeizigen Ziele der deutschen Klimapolitik. Wie haben denn seine Beiträge in der Runde für eine sachliche Atmosphäre ausgesehen? Gabriel überlegt, aber die Kanzlerin ist schneller.}
27
-
28
- #texts << %q{Deux autres personnes ont été arrêtées durant la nuit}
29
- #texts << %q{The links between the attempted car bombings in Glasgow and London are becoming clearer}
30
- #texts << %q{En estado de máxima alertaen su nivel de crítico}
31
- #texts << %q{Returns the object in enum with the maximum value.}
32
- #texts << %q{Propose des données au sujet de la langue espagnole.}
33
- #texts << %q{La palabra "mezquita" se usa en español para referirse a todo tipo de edificios dedicados.}
34
- #texts << %q{Fern- und Regionalzüge, aber auch die S-Bahnen in den Großstädten stehen still.}
35
-
36
- #texts.collect! { |t| (t + " ") * 5 }
37
-
38
- @wl = WhatLanguage.new(:all)
39
-
40
- puts Benchmark.measure {
41
-
42
- 100.times do
43
- texts.each { |text|
44
- lang = text.language.to_s.capitalize
45
- # puts "#{text[0..18]}... is in #{lang}"
46
- # puts @wl.process_text(text).sort_by{|a,b| b }.reverse.inspect
47
- # puts "---"
48
- }
49
- end
50
-
51
- }
data/lang/arabic.lang DELETED
Binary file
data/lang/danish.lang DELETED
Binary file
data/lang/dutch.lang DELETED
Binary file
data/lang/english.lang DELETED
Binary file
data/lang/farsi.lang DELETED
Binary file
data/lang/finnish.lang DELETED
Binary file
data/lang/french.lang DELETED
Binary file
data/lang/german.lang DELETED
Binary file
data/lang/greek.lang DELETED
Binary file
data/lang/hebrew.lang DELETED
Binary file
data/lang/hungarian.lang DELETED
Binary file
data/lang/italian.lang DELETED
Binary file
data/lang/korean.lang DELETED
Binary file
data/lang/norwegian.lang DELETED
Binary file
data/lang/pinyin.lang DELETED
Binary file
data/lang/polish.lang DELETED
Binary file
data/lang/portuguese.lang DELETED
Binary file
data/lang/russian.lang DELETED
Binary file
data/lang/spanish.lang DELETED
Binary file
data/lang/swedish.lang DELETED
Binary file
@@ -1,64 +0,0 @@
1
- # NAME: BitField
2
- # AUTHOR: Peter Cooper
3
- # LICENSE: MIT ( http://www.opensource.org/licenses/mit-license.php )
4
- # COPYRIGHT: (c) 2007 Peter Cooper (http://www.petercooper.co.uk/)
5
- # VERSION: v4
6
- # HISTORY: v4 (better support for loading and dumping fields)
7
- # v3 (supports dynamic bitwidths for array elements.. now doing 32 bit widths default)
8
- # v2 (now uses 1 << y, rather than 2 ** y .. it's 21.8 times faster!)
9
- # v1 (first release)
10
- #
11
- # DESCRIPTION: Basic, pure Ruby bit field. Pretty fast (for what it is) and memory efficient.
12
- # I've written a pretty intensive test suite for it and it passes great.
13
- # Works well for Bloom filters (the reason I wrote it).
14
- #
15
- # Create a bit field 1000 bits wide
16
- # bf = BitField.new(1000)
17
- #
18
- # Setting and reading bits
19
- # bf[100] = 1
20
- # bf[100] .. => 1
21
- # bf[100] = 0
22
- #
23
- # More
24
- # bf.to_s = "10101000101010101" (example)
25
- # bf.total_set .. => 10 (example - 10 bits are set to "1")
26
-
27
- class BitField
28
- attr_reader :size
29
- attr_accessor :field
30
- include Enumerable
31
-
32
- ELEMENT_WIDTH = 32
33
-
34
- def initialize(size)
35
- @size = size
36
- @field = Array.new(((size - 1) / ELEMENT_WIDTH) + 1, 0)
37
- end
38
-
39
- # Set a bit (1/0)
40
- def []=(position, value)
41
- value == 1 ? @field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH) : @field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)
42
- end
43
-
44
- # Read a bit (1/0)
45
- def [](position)
46
- @field[position / ELEMENT_WIDTH] & 1 << (position % ELEMENT_WIDTH) > 0 ? 1 : 0
47
- end
48
-
49
- # Iterate over each bit
50
- def each(&block)
51
- @size.times { |position| yield self[position] }
52
- end
53
-
54
- # Returns the field as a string like "0101010100111100," etc.
55
- def to_s
56
- inject("") { |a, b| a + b.to_s }
57
- end
58
-
59
- # Returns the total number of bits that are set
60
- # (The technique used here is about 6 times faster than using each or inject direct on the bitfield)
61
- def total_set
62
- @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }
63
- end
64
- end
@@ -1,88 +0,0 @@
1
- # NAME: BloominSimple
2
- # AUTHOR: Peter Cooper
3
- # LICENSE: MIT ( http://www.opensource.org/licenses/mit-license.php )
4
- # COPYRIGHT: (c) 2007 Peter Cooper
5
- # DESCRIPTION: Very basic, pure Ruby Bloom filter. Uses my BitField, pure Ruby
6
- # bit field library (http://snippets.dzone.com/posts/show/4234).
7
- # Supports custom hashing (default is 3).
8
- #
9
- # Create a Bloom filter that uses default hashing with 1Mbit wide bitfield
10
- # bf = BloominSimple.new(1_000_000)
11
- #
12
- # Add items to it
13
- # File.open('/usr/share/dict/words').each { |a| bf.add(a) }
14
- #
15
- # Check for existence of items in the filter
16
- # bf.includes?("people") # => true
17
- # bf.includes?("kwyjibo") # => false
18
- #
19
- # Add better hashing (c'est easy!)
20
- # require 'digest/sha1'
21
- # b = BloominSimple.new(1_000_000) do |item|
22
- # Digest::SHA1.digest(item.downcase.strip).unpack("VVVV")
23
- # end
24
- #
25
- # More
26
- # %w{wonderful ball stereo jester flag shshshshsh nooooooo newyorkcity}.each do |a|
27
- # puts "#{sprintf("%15s", a)}: #{b.includes?(a)}"
28
- # end
29
- #
30
- # # => wonderful: true
31
- # # => ball: true
32
- # # => stereo: true
33
- # # => jester: true
34
- # # => flag: true
35
- # # => shshshshsh: false
36
- # # => nooooooo: false
37
- # # => newyorkcity: false
38
-
39
- require 'whatlanguage/bitfield'
40
-
41
- class BloominSimple
42
- attr_accessor :bitfield, :hasher
43
-
44
- def initialize(bitsize, &block)
45
- @bitfield = BitField.new(bitsize)
46
- @size = bitsize
47
- @hasher = block || lambda do |word|
48
- word = word.downcase.strip
49
- [h1 = word.sum, h2 = word.hash, h2 + h1 ** 3]
50
- end
51
- end
52
-
53
- # Add item to the filter
54
- def add(item)
55
- @hasher[item].each { |hi| @bitfield[hi % @size] = 1 }
56
- end
57
-
58
- # Find out if the filter possibly contains the supplied item
59
- def includes?(item)
60
- @hasher[item].each { |hi| return false unless @bitfield[hi % @size] == 1 } and true
61
- end
62
-
63
- # Allows comparison between two filters. Returns number of same bits.
64
- def &(other)
65
- raise "Wrong sizes" if self.bitfield.size != other.bitfield.size
66
- same = 0
67
- #self.bitfield.size.times do |pos|
68
- # same += 1 if self.bitfield[pos] & other.bitfield[pos] == 1
69
- #end
70
- self.bitfield.total_set.to_s + "--" + other.bitfield.total_set.to_s
71
- end
72
-
73
- # Dumps the bitfield for a bloom filter for storage
74
- def dump
75
- [@size, *@bitfield.field].pack("I*")
76
- #Marshal.dump([@size, @bitfield])
77
- end
78
-
79
- # Creates a new bloom filter object from a stored dump (hasher has to be resent though for additions)
80
- def self.from_dump(data, &block)
81
- data = data.unpack("I*")
82
- #data = Marshal.load(data)
83
- temp = new(data[0], &block)
84
- temp.bitfield.field = data[1..-1]
85
- temp
86
- end
87
- end
88
-
@@ -1,11 +0,0 @@
1
- require 'whatlanguage'
2
-
3
- class String
4
- def language
5
- WhatLanguage.new(:all).language(self)
6
- end
7
-
8
- def language_iso
9
- WhatLanguage.new(:all).language_iso(self)
10
- end
11
- end
@@ -1,129 +0,0 @@
1
- # encoding: utf-8
2
- require "test/unit"
3
-
4
- # not a dependency
5
- begin
6
- require 'unicode_utils'
7
- rescue LoadError
8
- end
9
-
10
- require 'whatlanguage/string'
11
-
12
- class TestWhatLanguage < Test::Unit::TestCase
13
- def setup
14
- @wl = WhatLanguage.new(:all)
15
- end
16
-
17
- def test_string_method
18
- assert_equal :english, "This is a test".language
19
- end
20
-
21
- def test_string_iso_method
22
- assert_equal :en, "this is a test".language_iso
23
- end
24
-
25
- def test_arabic
26
- assert_equal :arabic, @wl.language("اللغة التي هي هذه؟")
27
- end
28
-
29
- def test_dutch
30
- assert_equal :dutch, @wl.language("Als hadden geweest is, is hebben te laat.")
31
- end
32
-
33
- def test_farsi
34
- assert_equal :farsi, @wl.language("وقتی مادرم به من آموخت که به آواز خواندن.")
35
- end
36
-
37
- def test_finnish
38
- assert_equal :finnish, @wl.language("Mitä kieltä tämä on?")
39
- end
40
-
41
- def test_french
42
- assert_equal :french, @wl.language("Bonjour, je m'appelle Sandrine. Voila mon chat.")
43
- end
44
-
45
- def test_german
46
- assert_equal :german, @wl.language("Welche Sprache ist das?")
47
- end
48
-
49
- def test_greek
50
- assert_equal :greek, @wl.language("Ποια γλώσσα είναι αυτή;")
51
- end
52
-
53
- def test_hebrew
54
- assert_equal :hebrew, @wl.language("באיזו שפה זה?")
55
- end
56
-
57
- def test_hungarian
58
- assert_equal :hungarian, @wl.language("Milyen nyelv ez?")
59
- end
60
-
61
- def test_italian
62
- assert_equal :italian, @wl.language("Roma, capitale dell'impero romano, è stata per secoli il centro politico e culturale della civiltà occidentale.")
63
- end
64
-
65
- def test_korean
66
- assert_equal :korean, @wl.language("이 어떤 언어인가?")
67
- end
68
-
69
- def test_norwegian
70
- assert_equal :norwegian, @wl.language("Hvilket språk er dette?")
71
- end
72
-
73
- def test_polish
74
- assert_equal :polish, @wl.language("W jakim języku to jest?")
75
- end
76
-
77
- def test_portuguese
78
- assert_equal :portuguese, @wl.language("Que linguagem é essa?")
79
- end
80
-
81
- def test_russian
82
- assert_equal :russian, @wl.language("Все новости в хронологическом порядке")
83
- end
84
-
85
- def test_spanish
86
- assert_equal :spanish, @wl.language("La palabra mezquita se usa en español para referirse a todo tipo de edificios dedicados.")
87
- end
88
-
89
- def test_swedish
90
- assert_equal :swedish, @wl.language("Vilket språk är detta?")
91
- end
92
-
93
- def test_danish
94
- assert_equal :danish, @wl.language("Dansk er et nord-germansk sprog af den østnordiske (kontinentale) gruppe, der tales af ca. seks millioner mennesker.")
95
- end
96
-
97
- def test_nothing
98
- assert_nil @wl.language("")
99
- end
100
-
101
- def test_something
102
- assert_not_nil @wl.language("test")
103
- end
104
-
105
- def test_processor
106
- assert_kind_of Hash, @wl.process_text("this is a test")
107
- end
108
-
109
- def test_language_selection
110
- selective_wl = WhatLanguage.new(:german, :english)
111
- assert_equal :german, selective_wl.language("der die das")
112
- end
113
-
114
- def test_language_selection_empty
115
- selective_wl = WhatLanguage.new()
116
- assert_equal :russian, selective_wl.language("Все новости в хронологическом порядке")
117
- end
118
-
119
- def test_language_selection_mixed
120
- selective_wl = WhatLanguage.new(:german, :all, :english)
121
- assert_equal :russian, selective_wl.language("Все новости в хронологическом порядке")
122
- end
123
-
124
- if defined? UnicodeUtils
125
- def test_casing_conversion
126
- assert_equal "âncora cor âmbar".language, "ÂNCORA COR ÂMBAR".language
127
- end
128
- end
129
- end