class BioInterchange::TextMining::TMReader
Public Class Methods
Create a new instance of a text-mining data reader. Sets @process to a new BioInterchange::TextMining::Process
object.
name
-
Name of the process which generated this data
name_id
-
URI of the resource that generated this data
date
-
Optional date of data creation
processtype
-
Type of process that created this content
version
-
Optional version number of resource that created this data (nil if manually curated, for example).
# 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 metadata = {} metadata[BioInterchange::TextMining::Process::VERSION] = version @process = BioInterchange::TextMining::Process.new(name, name_id, processtype, metadata, date) end
Protected Class Methods
Automatically tries to determine a suitable process from the given name ID, which is assumed to be either an email address or web-site.
name_id
-
name ID that we want to represent by a suitable process
# File lib/biointerchange/textmining/text_mining_reader.rb, line 41 def self.determine_process(name_id) process = BioInterchange::TextMining::Process::UNSPECIFIED process = BioInterchange::TextMining::Process::MANUAL if name_id.match(/[^@]+@[^@]+/) process = BioInterchange::TextMining::Process::SOFTWARE if name_id.match(/[a-zA-Z]+:\/\//) process end
Public Instance Methods
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.
inputstream
-
Input IO stream to deserialize
# 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
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.
# File lib/biointerchange/textmining/text_mining_reader.rb, line 31 def postponed? false end