class BioInterchange::TextMining::Content
Constants
- ABSTRACT
- AUTHOR
- CHARACTER
- DOCUMENT
- PAGE
- PARAGRAPH
- PHRASE
- SECTION
- SENTENCE
- TITLE
- UNSPECIFIED
Constants that describe content types.
- WORD
Public Class Methods
Creates a new document content representation at a specific location of the document.
offset
-
zero-based offset of the represented content within the document (absolute location within the document)
length
-
length of the represented content, where a length of zero denotes a boundary between two characters
type
-
classifaction of the content
# File lib/biointerchange/textmining/content.rb, line 24 def initialize(offset, length, type = UNSPECIFIED, process = nil) @offset = offset @length = length @type = type @process = process end
Public Instance Methods
Returns the length of the content, which is measured in characters.
# File lib/biointerchange/textmining/content.rb, line 44 def length @length end
Returns the offset of the content as absolute position within the document.
# File lib/biointerchange/textmining/content.rb, line 39 def offset @offset end
Returns the process associated with this content, if previously provided, or nil otherwise.
# File lib/biointerchange/textmining/content.rb, line 54 def process @process end
Sets the context of this content.
context
-
a
BioInterchange::TextMining::Document
orBioInterchange::TextMining::Content
instance in which this content is enclosed in
# File lib/biointerchange/textmining/content.rb, line 34 def setContext(context) @context = context end
Returns the type of the content, if known, or +BioInterchange::TextMining::Content::UNSPECIFIED otherwise.
# File lib/biointerchange/textmining/content.rb, line 49 def type @type end
Returns a URI that identifies this content.
# File lib/biointerchange/textmining/content.rb, line 59 def uri raise BioInterchange::Exceptions::ImplementationModelError, 'An URI can only be returned for content with a context (i.e., use setContext(context) first).' unless @context process = '-' process = "(#{@process.uri.sub(/^.*?:\/\//, '')})" if @process "biointerchange://textmining/content/#{@context.uri.sub(/^.*?:\/\//, '')}/#{@offset},#{@length},#{@type},#{process}" end