This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

corpusLanguage

Detect language of text

Use corpusLanguage to detect language of text.

The function supports English, Japanese, and German text.

Syntax

language = corpusLanguage(str)

Description

example

language = corpusLanguage(str) detects the language of the text in str.

Examples

collapse all

Detect the language of a string array of text.

str = [
    "恋の悩みで 苦しむ。"
    "空の星が輝きを増している。"];
language = corpusLanguage(str)
language = 
'ja'

Input Arguments

collapse all

Input text, specified as a string array, character vector, or cell array of character vectors.

Example: ["An example of a short sentence."; "A second short sentence."]

Data Types: string | char | cell

Output Arguments

collapse all

Detected language, returned as one of the following:

  • 'en' – Detected English text

  • 'ja' – Detected Japanese text

  • 'de' – Detected German text

Introduced in R2018b