Lua APIΒΆ
Chinese Text Analyser exposes a module cta
that you can include in your own Lua scripts to
gain access to features and functionality such as text segmentation and
processing, statistics, word lists and dictionaries.
The cta
module includes the following functions:
- cta
- cta.askUserForDirectory()
cta.askUserForDirectory( title ) - cta.askUserForFileToOpen()
cta.askUserForFileToOpen( options ) - cta.askUserForFileToSave()
cta.askUserForFileToSave( title ) - cta.dictionary()
- cta.Document( filename, options )
- cta.hskLevel( level )
cta.hskLevel( lowerLevel, upperLevel ) - cta.tocflLevel( level )
cta.tocflLevel( lowerLevel, upperLevel ) - cta.knownWords()
- cta.lookedUpWords()
- cta.openDocuments()
- print()
cta.print() - cta.Text( text )
- cta.WordList()
cta.WordList( filename ) - cta.write()
- cta.askUserForDirectory()
- Dictionary
- Document
- Document( filename, options )
- Document:hasFinishedProcessing()
- Document:process()
- Document:startProcessing()
- Document:waitUntilProcessed()
- Document:name()
- Document:tostring()
- Document:lines( includeNewlines )
- Document:allWords()
- Document:knownWords( wordList )
- Document:unknownWords( wordList )
- Document:allStatistics( options )
- Document:knownStatistics( options )
- Document:unknownStatistics( options )
- Document:findWord( word )
- Document:findLinesContaining( word )
- Document:findSentencesContaining( word )
- Text
- WordList
In addition, Chinese Text Analyser also comes with the lfs module and the lua-csv module to provide support for accessing the file system and for reading and writing comma (and tab) separated files.
These can be included in your scripts as follows:
1 2 | local lfs = require 'lfs'
local csv = require 'csv'
|
And then you can use the lfs
and csv
variables to access the
functionality of these modules.