Class | EstraierPure::Document
In: | estraierpure.rb
Parent: | Object

Abstraction of document.

### Methods

add_attr add_hidden_text add_text attr attr_names cat_texts dump_draft id keywords new score set_keywords set_score texts

### Public Class methods

new(draft = "")

Create a document object. `draft’ specifies a string of draft data.

### Public Instance methods

add_attr(name, value)

Add an attribute. `name’ specifies the name of an attribute. `value’ specifies the value of the attribute. If it is `nil’, the attribute is removed. The return value is always `nil’.

add_hidden_text(text)

Add a hidden sentence. `text’ specifies a hidden sentence. The return value is always `nil’.

add_text(text)

Add a sentence of text. `text’ specifies a sentence of text. The return value is always `nil’.

attr(name)

Get the value of an attribute. `name’ specifies the name of an attribute. The return value is the value of the attribute or `nil’ if it does not exist.

attr_names()

Get an array of attribute names of a document object. The return value is an array object of attribute names.

cat_texts()

Concatenate sentences of the text of a document object. The return value is concatenated sentences.

dump_draft()

Dump draft data of a document object. The return value is draft data.

id()

Get the ID number. The return value is the ID number of the document object. If the object has never been registered, -1 is returned.

keywords()

Get attached keywords. The return value is a map object of keywords and their scores in decimal string. If no keyword is attached, `nil’ is returned.

score()

Get the substitute score. The return value is the substitute score or -1 if it is not set.

set_keywords(kwords)

Attach keywords. `kwords’ specifies a map object of keywords. Keys of the map should be keywords of the document and values should be their scores in decimal string. The return value is always `nil’.

set_score(score)

Set the substitute score. `score’ specifies the substitute score. It it is negative, the substitute score setting is nullified. The return value is always `nil’.

texts()

Get an array of sentences of the text. The return value is an array object of sentences of the text.

[Validate]