corpusLanguage - Detect language of text - MATLAB (original) (raw)

Main Content

Syntax

Description

Use corpusLanguage to detect language of text.

The function supports English, Japanese, German, and Korean text.

[language](#mw%5Fbdb32316-118a-4e2f-b782-a27cd51db78c) = corpusLanguage([str](#d126e13697)) detects the language of the text in str. The detected language can be more accurate when you use longer input text.

example

Examples

collapse all

Detect the language of a string array of text.

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

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:

Version History

Introduced in R2018b