Class LanguageIdentifier.Session
java.lang.Object
com.codename1.ai.language.LanguageIdentifier.Session
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
LanguageIdentifier
Reusable owner of a native language-identification backend.
A session accepts multiple asynchronous requests. Calling
close() prevents new requests immediately and defers native
release until requests already in progress have completed.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the session.Identifies languages without recreating the native backend.
-
Method Details
-
identify
Identifies languages without recreating the native backend. Cancelling the returned resource suppresses late callbacks without closing this reusable session.- Parameters:
text- text to classify;nullis treated as empty- Returns:
- asynchronous ranked candidates, possibly empty
- Throws:
IllegalStateException- if this session is closed
-
close
public void close()Closes the session. This method is idempotent; native release is deferred until pending identifications finish.- Specified by:
closein interfaceAutoCloseable
-