Class: BioInterchange::TextMining::TMReader
- Defined in:
- lib/biointerchange/textmining/text_mining_reader.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#deserialize(inputstream) ⇒ Object
Reads input stream and returns associated model.
-
#initialize(name, name_id, date = nil, processtype = BioInterchange::TextMining::Process::UNSPECIFIED, version = nil) ⇒ TMReader
constructor
Create a new instance of a text-mining data reader.
-
#postponed? ⇒ Boolean
Returns true if the reading of the input was postponed due to a full batch.
Constructor Details
#initialize(name, name_id, date = nil, processtype = BioInterchange::TextMining::Process::UNSPECIFIED, version = nil) ⇒ TMReader
Create a new instance of a text-mining data reader. Sets @process to a new BioInterchange::TextMining::Process object.
nameName of the process which generated this data
name_idURI of the resource that generated this data
dateOptional date of data creation
processtypeType of process that created this content
versionOptional version number of resource that created this data (nil if manually curated, for example).
12 13 14 15 16 17 18 |
# File 'lib/biointerchange/textmining/text_mining_reader.rb', line 12 def initialize(name, name_id, date = nil, processtype = BioInterchange::TextMining::Process::UNSPECIFIED, version = nil) raise ArgumentError, 'Require "name" and "name_id" options to specify source of annotations (e.g., a manual annotators name, or software tool name) and their associated URI (e.g., email address, or webaddress).' unless name and name_id = {} [BioInterchange::TextMining::Process::VERSION] = version @process = BioInterchange::TextMining::Process.new(name, name_id, processtype, , date) end |
Instance Method Details
#deserialize(inputstream) ⇒ Object
Reads input stream and returns associated model. Super call this method before before overriding to provide access to a @data string containing the inputstream text.
inputstreamInput IO stream to deserialize
24 25 26 |
# File 'lib/biointerchange/textmining/text_mining_reader.rb', line 24 def deserialize(inputstream) raise BioInterchange::Exceptions::ImplementationReaderError, 'InputStream not of type IO, cannot read.' unless inputstream.kind_of?(IO) end |
#postponed? ⇒ Boolean
Returns true if the reading of the input was postponed due to a full batch. The current implementation does not support batch processing though, which means that this method always returns false.
31 32 33 |
# File 'lib/biointerchange/textmining/text_mining_reader.rb', line 31 def postponed? false end |