List of probably languages for a text

Share:

Description

Returns the scores for all languages that use the same script as the input text, in decreasing order of probability. The score is calculated from the distances of the trigram distributions in the input text and in the language model. The closer the languages, the higher the score. Scores are scaled, so that the closest language will have a score of 1.

Usage

1
2
franc_all(text, min_speakers = 1e+06, whitelist = NULL, blacklist = NULL,
  min_length = 10, max_length = 2048)

Arguments

text

A string constant. Should be at least min_length characters long, this is 10 chracters by default. Only the first max_length characters are used (2048 by default), to make the detection reasonably fast.

min_speakers

Languages with at least this many speakers are checked. By default this is one million. Set it to zero to include all languages known by franc. See also speakers.

whitelist

List of three letter language codes to check against.

blacklist

List of three letter language codes not to check againts.

min_length

Minimum number of characters required in the text.

max_length

Maximum number of characters used from the text. By default only the first 2048 characters are used.

Value

A data frame with columns language and score. The language column contains the three letter ISO-639-3 language codes. The score column contains the scores.

See Also

franc if you only want the top result, speakers.

Examples

1
2
3
4
5
6
7
8
9
head(franc_all("O Brasil caiu 26 posições"))

## Provide a whitelist:
franc_all("O Brasil caiu 26 posições",
  whitelist = c("por", "src", "glg", "spa"))

## Provide a blacklist:
head(franc_all("O Brasil caiu 26 posições",
  blacklist = c("src", "glg", "lav")))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.