net.java.sen
クラス ReadingProcessor

java.lang.Object
  上位を拡張 net.java.sen.ReadingProcessor

public class ReadingProcessor
extends java.lang.Object

A text processor that builds reading data suitable for application as furigana. ReadingFilters can be used to refine and customise the output

See examples.ReadingProcessorDemo in the Sen source for an example of how to use this class

Thread Safety: Objects of this class are NOT thread safe and should not be accessed simultaneously by multiple threads. Note that creating additional instances using SenFactory is relatively cheap in both memory and time


入れ子のクラスの概要
static class ReadingProcessor.ReadingResult
          The result of reading processing.
 
コンストラクタの概要
ReadingProcessor(Tokenizer tokenizer)
           
 
メソッドの概要
 void addFilter(int priority, ReadingFilter filter)
          Adds a reading filter to be applied during processing
 void clearFilters()
          Removes any previously set reading filters
 java.util.List<Reading> getDisplayReadings()
          Returns a list of readings generated from the current text.
 java.util.Map<java.lang.Integer,ReadingFilter> getFilters()
          Returns the complete set of reading filters currently applied during processing
 Reading getReadingConstraint(int position)
          Gets a reading constraint set on the currently analysed text
 ReadingProcessor.ReadingResult process()
          Performs full reading processing and returns a ReadingProcessor.ReadingResult object isolated from further changes to the reading processor
 void removeFilter(int priority)
          Removes the filter with the given priority, if it exists
 void removeReadingConstraint(int position)
          Remove the reading constraint at the given position
 void setFilters(java.util.Map<java.lang.Integer,ReadingFilter> filters)
          Sets all reading filters to be applied during processing.
 void setReadingConstraint(Reading constraint)
          Sets a reading constraint on the currently analysed text.
 void setText(java.lang.String text)
          Sets the currently analysed text.
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ReadingProcessor

public ReadingProcessor(Tokenizer tokenizer)
パラメータ:
tokenizer - The Tokenizer to use
メソッドの詳細

setText

public void setText(java.lang.String text)
Sets the currently analysed text. The reset() method will be invoked on any currently set filters in order to clear sentence specific state

パラメータ:
text - The text to analyse

addFilter

public void addFilter(int priority,
                      ReadingFilter filter)
Adds a reading filter to be applied during processing

パラメータ:
priority - The precedence of the filter. Lower numbered filters are applied first. If a filter is added with the same priority as an existing filter, the existing filter will be overwritten
filter - The filter to add

removeFilter

public void removeFilter(int priority)
Removes the filter with the given priority, if it exists

パラメータ:
priority - The priority of the filter to remove

setFilters

public void setFilters(java.util.Map<java.lang.Integer,ReadingFilter> filters)
Sets all reading filters to be applied during processing. Any existing filters are discarded

パラメータ:
filters - The filters to use

clearFilters

public void clearFilters()
Removes any previously set reading filters


getFilters

public java.util.Map<java.lang.Integer,ReadingFilter> getFilters()
Returns the complete set of reading filters currently applied during processing

戻り値:
The reading filters

getReadingConstraint

public Reading getReadingConstraint(int position)
Gets a reading constraint set on the currently analysed text

パラメータ:
position - The index within the sentence to get the constraint at
戻り値:
The constraint

setReadingConstraint

public void setReadingConstraint(Reading constraint)
Sets a reading constraint on the currently analysed text.
Note: In contrast to constraints set directly on a Viterbi instance, there is no need to pass the constraint in katakana; the exact reading text supplied will appear in the analysed readings

パラメータ:
constraint -

removeReadingConstraint

public void removeReadingConstraint(int position)
Remove the reading constraint at the given position

パラメータ:
position - The position from which to remove the constraint

getDisplayReadings

public java.util.List<Reading> getDisplayReadings()
Returns a list of readings generated from the current text. If all you need is the readings, this will be marginally quicker than calling process() and then ReadingProcessor.ReadingResult.getDisplayReadings()

戻り値:
The readings

process

public ReadingProcessor.ReadingResult process()
Performs full reading processing and returns a ReadingProcessor.ReadingResult object isolated from further changes to the reading processor

戻り値:
An object containing the results of processing


Copyright ? 2008. All Rights Reserved.