app/models/annotator.rb
# To obtain annotations from an annotator and to save them in the project
To obtain annotations from an annotator and to save them in the project
To obtain annotations from an annotator and to save them in the project
def obtain_annotations(docs)
		method, url, params, payload = prepare_request(docs)
		result = make_request(method, url, params, payload)
		annotations_col = (result.class == Array) ? result : [result]
		annotations_col.each_with_index do |annotations, i|
			raise RuntimeError, "Invalid annotation JSON object." unless annotations.respond_to?(:has_key?)
			annotations[:text] = docs[i][:text] unless annotations[:text].present?
			annotations[:sourcedb] = docs[i][:sourcedb] unless annotations[:sourcedb].present?
			annotations[:sourceid] = docs[i][:sourceid] unless annotations[:sourceid].present?
			Annotation.normalize!(annotations)
			annotations_transform!(annotations)
		end
		annotations_col
	end
def obtain_annotations ( docs ) method , url , params , payload = prepare_request ( docs ) result = make_request ( method , url , params , payload ) annotations_col = ( result . class == Array ) ? result : [ result ] annotations_col . each_with_index do | annotations , i | raise RuntimeError , "Invalid annotation JSON object." unless annotations . respond_to? ( :has_key? ) annotations [ :text ] = docs [ i ] [ :text ] unless annotations [ :text ] . present? annotations [ :sourcedb ] = docs [ i ] [ :sourcedb ] unless annotations [ :sourcedb ] . present? annotations [ :sourceid ] = docs [ i ] [ :sourceid ] unless annotations [ :sourceid ] . present? Annotation . normalize! ( annotations ) annotations_transform! ( annotations ) end annotations_col end
To obtain annotations from an annotator and to save them in the project
To obtain annotations from an annotator and to save them in the project
# To recover the identity information, in case of syncronous annotation
docs
<not_specific>