Allow tokens to be passed directly to classify

This commit is contained in:
Joshua Peek
2012-06-19 14:17:27 -05:00
parent d0691988a9
commit 8f85a447de
2 changed files with 8 additions and 3 deletions

View File

@@ -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|