<commit_before>/**
 * 
 */
package edu.ucdenver.ccp.nlp.ext.uima.collections.line;

import edu.ucdenver.ccp.common.string.RegExPatterns;
import edu.ucdenver.ccp.common.string.StringConstants;
import edu.ucdenver.ccp.nlp.core.document.GenericDocument;

/**
 * Designed to extract a Medline document from a line using the following format: <br>
 * pmid <tab> title <tab> abstract <br>
 * The output text consists of the title on one line, and the abstract on the next line (if the
 * Medline record has an abstract). <br>
 * 
 * Note: some abstracts have tabs in them.
 * 
 * @author Center for Computational Pharmacology, UC Denver; <EMAIL>
 * 
 */
public class MedlineLineDocumentExtractor implements DocumentExtractor {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * edu.ucdenver.ccp.nlp.ext.uima.collections.line.DocumentExtractor#extractDocument(java.lang
	 * .String)
	 */
	@Override
	public GenericDocument extractDocument(String line) {
		String[] toks = line.split(RegExPatterns.TAB);
		String pmidStr = toks[0];<commit_msg>If an invalid line is encountered, a null document is now returned.<commit_after>/**
 * 
 */
package edu.ucdenver.ccp.nlp.ext.uima.collections.line;

import edu.ucdenver.ccp.common.string.RegExPatterns;
import edu.ucdenver.ccp.common.string.StringConstants;
import edu.ucdenver.ccp.nlp.core.document.GenericDocument;

/**
 * Designed to extract a Medline document from a line using the following format: <br>
 * pmid <tab> title <tab> abstract <br>
 * The output text consists of the title on one line, and the abstract on the next line (if the
 * Medline record has an abstract). <br>
 * 
 * Note: some abstracts have tabs in them.
 * 
 * @author Center for Computational Pharmacology, UC Denver; <EMAIL>
 * 
 */
public class MedlineLineDocumentExtractor implements DocumentExtractor {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * edu.ucdenver.ccp.nlp.ext.uima.collections.line.DocumentExtractor#extractDocument(java.lang
	 * .String)
	 */
	@Override
	public GenericDocument extractDocument(String line) {
		String[] toks = line.split(RegExPatterns.TAB);
		if (line.isEmpty() || toks.length < 2)
			return null;
		String pmidStr = toks[0];
{'fraction_non_alphanumeric': 0.11198519204072188, 'fraction_numerical': 0.0013882461823229986, 'mean_word_length': 4.172248803827751, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2150503', 'n_tokens_mistral': 744, 'n_tokens_neox': 699, 'n_words': 194}