mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Allow tokens to be passed directly to classify
This commit is contained in:
@@ -74,7 +74,7 @@ module Linguist
|
||||
|
||||
# Public: Guess language of data.
|
||||
#
|
||||
# data - String data to analyze.
|
||||
# data - Array of tokens or String data to analyze.
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
@@ -83,8 +83,8 @@ module Linguist
|
||||
#
|
||||
# Returns sorted Array of result pairs. Each pair contains the
|
||||
# Language and a Float score.
|
||||
def classify(data)
|
||||
tokens = Tokenizer.new(data).tokens
|
||||
def classify(tokens)
|
||||
tokens = Tokenizer.new(tokens).tokens if tokens.is_a?(String)
|
||||
|
||||
scores = {}
|
||||
@languages.keys.each do |language|
|
||||
|
||||
Reference in New Issue
Block a user