Class: Estraier::Document
- Inherits:
-
Object
- Object
- Estraier::Document
- Defined in:
- lib/estraier/estraier-doc.rb
Overview
++ Abstraction of document.
Instance Method Summary collapse
-
#add_attr(name, value) ⇒ Object
Add an attribute.
-
#add_hidden_text(text) ⇒ Object
Add a hidden sentence.
-
#add_text(text) ⇒ Object
Add a sentence of text.
-
#attr(name) ⇒ Object
Get the value of an attribute.
-
#attr_names ⇒ Object
Get an array of attribute names of a document object.
-
#cat_texts ⇒ Object
Concatenate sentences of the text of a document object.
-
#dump_draft ⇒ Object
Dump draft data of a document object.
-
#id ⇒ Object
Get the ID number.
-
#keywords ⇒ Object
Get attached keywords.
-
#make_snippet(words, wwidth, hwidth, awidth) ⇒ Object
Make a snippet of the body text.
-
#score ⇒ Object
Get the substitute score.
-
#set_keywords(kwords) ⇒ Object
Attach keywords.
-
#set_score(score) ⇒ Object
Set the substitute score.
-
#texts ⇒ Object
Get an array of sentences of the text.
Instance Method Details
#add_attr(name, value) ⇒ Object
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’.
34 35 36 |
# File 'lib/estraier/estraier-doc.rb', line 34 def add_attr(name, value) # native code ... end |
#add_hidden_text(text) ⇒ Object
Add a hidden sentence. ‘text’ specifies a hidden sentence. The return value is always ‘nil’.
46 47 48 |
# File 'lib/estraier/estraier-doc.rb', line 46 def add_hidden_text(text) # native code ... end |
#add_text(text) ⇒ Object
Add a sentence of text. ‘text’ specifies a sentence of text. The return value is always ‘nil’.
40 41 42 |
# File 'lib/estraier/estraier-doc.rb', line 40 def add_text(text) # native code ... end |
#attr(name) ⇒ Object
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.
77 78 79 |
# File 'lib/estraier/estraier-doc.rb', line 77 def attr(name) # native code ... end |
#attr_names ⇒ Object
Get an array of attribute names of a document object. The return value is an array object of attribute names.
71 72 73 |
# File 'lib/estraier/estraier-doc.rb', line 71 def attr_names() # native code ... end |
#cat_texts ⇒ Object
Concatenate sentences of the text of a document object. The return value is concatenated sentences.
87 88 89 |
# File 'lib/estraier/estraier-doc.rb', line 87 def cat_texts() # native code ... end |
#dump_draft ⇒ Object
Dump draft data of a document object. The return value is draft data.
103 104 105 |
# File 'lib/estraier/estraier-doc.rb', line 103 def dump_draft() # native code ... end |
#id ⇒ Object
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.
66 67 68 |
# File 'lib/estraier/estraier-doc.rb', line 66 def id() # native code ... end |
#keywords ⇒ Object
Get attached keywords. The return value is a hash object of keywords and their scores in decimal string. If no keyword is attached, ‘nil’ is returned.
93 94 95 |
# File 'lib/estraier/estraier-doc.rb', line 93 def keywords() # native code ... end |
#make_snippet(words, wwidth, hwidth, awidth) ⇒ Object
Make a snippet of the body text. ‘words’ specifies an array object of words to be highlight. ‘wwidth’ specifies whole width of the result. ‘hwidth’ specifies width of strings picked up from the beginning of the text. ‘awidth’ width of strings picked up around each highlighted word. The return value is a snippet string of the body text. There are tab separated values. Each line is a string to be shown. Though most lines have only one field, some lines have two fields. If the second field exists, the first field is to be shown with highlighted, and the second field means its normalized form.
115 116 117 |
# File 'lib/estraier/estraier-doc.rb', line 115 def make_snippet(words, wwidth, hwidth, awidth) # native code ... end |
#score ⇒ Object
Get the substitute score. The return value is the substitute score or -1 if it is not set.
98 99 100 |
# File 'lib/estraier/estraier-doc.rb', line 98 def score() # native code ... end |
#set_keywords(kwords) ⇒ Object
Attach keywords. ‘kwords’ specifies a hash object of keywords. Keys of the hash should be keywords of the document and values should be their scores in decimal string. The return value is always ‘nil’.
53 54 55 |
# File 'lib/estraier/estraier-doc.rb', line 53 def set_keywords(kwords) # native code ... end |
#set_score(score) ⇒ Object
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’.
60 61 62 |
# File 'lib/estraier/estraier-doc.rb', line 60 def set_score(score) # native code ... end |
#texts ⇒ Object
Get an array of sentences of the text. The return value is an array object of sentences of the text.
82 83 84 |
# File 'lib/estraier/estraier-doc.rb', line 82 def texts() # native code ... end |