langident - Man Page

identifies the language files are written in


  langident [OPTIONS] file1 [file2 ...]


Identifies the language files are written in using Perl module Lingua::Identify.



Show all results (not just the most probable language).


Show confidence level for most probable language (it will be the first value right after the most probable language).


Debug (development only).

-e Encoding

Select an input encoding. Defaults to UTF-8.

  # use ISO-8859-1 (latin1)
  langident -E ISO-8859-1 file


Select the method(s) to use. There are three ways of doing this:

  # simply using a method
  langident -e ngrams3 file

  # using several methods (separate them with a comma)
  langident -e prefixes3,suffixes3

  # using several methods and assign different weights to each of them
  langident -e smallwords=2,prefixes=1,ngrams3=1.3

The available methods are the following: smallwords, prefixes1, prefixes2, prefixes3, prefixes4, suffixes1, suffixes2, suffixes3, suffixes4, ngrams1, ngrams2, ngrams3 and ngrams4.


Display help message and exit.


List all available languages and exit.


Set maximum number of results (languages) to display (shows the N most probable languages, by descending order of probability).

Overrides the -a switch.


Only work with specified languages.

  # identify between Portuguese and English only
  langident -o pt,en *


Also show percentages.


Maximum size to examine.


Show version and exit.


Use methods ngrams2 and ngrams1, assigning the double of importance to ngrams2 (-e switch); output will include the three most probable languages (-m switch) with its percentages (-p switch) and also the confidence level (-c switch) of the first result.

  $ langident -e ngrams2=2,ngrams1 -c -p -m 3 README 
  README:en 65.7209505939491 7.8971987481393 ga 4.11905889385895 tr 4.08487011400505

To Do

See Also

Lingua::Identify(3), Text::ExtractWords(3), Text::Ngram(3), Text::Affixes(3).

A linguist and/or a shrink.

The latest CVS version of Lingua::Identify (which includes langident) can be attained at

ISO 639 Language Codes, at


Jose Alves de Castro, <>

Referenced By


2024-01-25 perl v5.38.2 User Contributed Perl Documentation