Checks and returns the figure caption keyword at the beginning of a give line

@param line
input line
@return matched keyword if found / null if not found
352295
private String getMatchedFigureKeyword(String line) {
    	for (String keyword : Config.FIGURE_KEYWORDS) {
    		if (line.startsWith(keyword)) {
    			return keyword;
    		}
    	}
    	return null;
    }
1004379
private String mkPreview(int line) {
        StringBuilder sb = new StringBuilder();
        int startLine = line - 3;
        int endLine = line + 3;
        List<String> lines = multiSourceReader.getData();
        for (int i = 0; i < lines.size(); i++) {
            if (i >= startLine && i <= endLine) {
                sb.append(lines.get(i)).append('\n');
            }
        }
        return sb.toString();
    }
572605
def match(line, keyword):
    

    line = line.lstrip()
    length = len(keyword)
    if line[:length] == keyword:
        return line[length:]
    else:
        if keyword in line:
            return line[line.index(keyword):]
        else:
            return None
554028
public synchronized void consumeLine(final String line) {

        // check if the output contains the error string
        if (StringUtils.isNotEmpty(errorStr)) {
            // YES: set error flag
            if (StringUtils.equalsIgnoreCase(line.trim(), errorStr)) {
                foundError = true;
            }
        }
    }
416302
private CoreLabel makeCoreLabel(String line) {
    CoreLabel wi = new CoreLabel();
    // wi.line = line;
    String[] bits = line.split("\\s+");
    switch (bits.length) {
    case 0:
    case 1:
      wi.setWord(BOUNDARY);
      wi.set(AnswerAnnotation.class, OTHER);
      break;
    case 2:
      wi.setWord(bits[0]);
      wi.set(AnswerAnnotation.class, bits[1]);
      break;
    case 3:
      wi.setWord(bits[0]);
      wi.setTag(bits[1]);
      wi.set(AnswerAnnotation.class, bits[2]);
      break;
    case 4:
      wi.setWord(bits[0]);
      wi.setTag(bits[1]);
      wi.set(ChunkAnnotation.class, bits[2]);
      wi.set(AnswerAnnotation.class, bits[3]);
      break;
    case 5:
      if (flags.useLemmaAsWord) {
        wi.setWord(bits[1]);
      } else {
        wi.setWord(bits[0]);
        }
      wi.set(LemmaAnnotation.class, bits[1]);
      wi.setTag(bits[2]);
      wi.set(ChunkAnnotation.class, bits[3]);
      wi.set(AnswerAnnotation.class, bits[4]);
      break;
    default:
      throw new RuntimeIOException("Unexpected input (many fields): " + line);
    }
    wi.set(OriginalAnswerAnnotation.class, wi.get(AnswerAnnotation.class));
    return wi;
  }
178713
private void highlightLinesAfter( String content, int line )
    throws BadLocationException
  {
    int offset = _root.getElement( line ).getEndOffset();
    // Start/End delimiter not found, nothing to do
    int startDelimiter = indexOf( content, getStartDelimiter(), offset );
    int endDelimiter = indexOf( content, getEndDelimiter(), offset );
    if( startDelimiter < 0 )
    {
      startDelimiter = content.length();
    }
    if( endDelimiter < 0 )
    {
      endDelimiter = content.length();
    }
    int delimiter = Math.min( startDelimiter, endDelimiter );
    if( delimiter < offset )
    {
      return;
    }
    // Start/End delimiter found, reapply highlighting
    int endLine = _root.getElementIndex( delimiter );
    for( int i = line + 1; i < endLine; i++ )
    {
      Element branch = _root.getElement( i );
      Element leaf = getCharacterElement( branch.getStartOffset() );
      AttributeSet as = leaf.getAttributes();
      if( as.isEqual( _comment ) )
      {
        applyHighlighting( content, i );
      }
    }
  }
1311437
private ShellCommand getCommandForLine(final String line) {

		final int pos                             = line.indexOf(" ");
		final String commandString                = pos > 0 ? line.substring(0, pos) : line;
		final Class<? extends ShellCommand> clazz = commands.get(commandString);

		if (clazz != null) {

			try {

				return clazz.newInstance();

			} catch (Throwable t) {
				logger.warn("", t);
			}
		}

		return null;
	}
1034871
def _scan_line(self, line):
        
        is_quote_header = self.QUOTE_HDR_REGEX.match(line) is not None
        is_quoted = self.QUOTED_REGEX.match(line) is not None
        is_header = is_quote_header or self.HEADER_REGEX.match(line) is not None

        if self.fragment and len(line.strip()) == 0:
            if self.SIG_REGEX.match(self.fragment.lines[-1].strip()):
                self.fragment.signature = True
                self._finish_fragment()

        if self.fragment \
                and ((self.fragment.headers == is_header and self.fragment.quoted == is_quoted) or
                         (self.fragment.quoted and (is_quote_header or len(line.strip()) == 0))):

            self.fragment.lines.append(line)
        else:
            self._finish_fragment()
            self.fragment = Fragment(is_quoted, line, headers=is_header)
1192715
private String getRequestUrl(String line) {
    int end = line.length() - 2;
    while (line.charAt(end) != ' ') {
      end--;
    }

    int start = end - 1;
    while (line.charAt(start) != ' ') {
      start--;
    }
    return line.substring(start + 1, end);
  }
842523
public List<String> parse(String line) throws ParseException {
    List<String> cols = new ArrayList<>();
    boolean afterQuote = false;
    boolean afterEscape = false;
    boolean afterSeparator = false;
    boolean outerQuote = false;
    boolean afterEndField = false;
    StringBuilder sb = new StringBuilder();

    for (int i = 0; ; ++i) {
      char c = (i == line.length()) ? EOT : line.charAt(i);
      if (afterEndField && c != separator && c != EOT) {
        if (!trim || c != ' ') {
          throw new ParseException("Extraneous character after end of quoted field", i);
        }
      } else if (afterEscape) {
        if (c == EOT) {
          // [abc\^]
          throw new ParseException("Escape not followed by a character", i);
        } else {
          // [abc\x...] => abcx...
          afterEscape = false;
          sb.append(c);
        }
      } else if (c == separator) {
        if (outerQuote && !afterQuote) {
          // ["abc,...] => abc,...
          sb.append(c);
          afterSeparator = false;
        } else {
          // [abc,...] => {abc, ...}
          endCol(cols, sb, i, outerQuote, afterQuote);
          afterQuote = afterEscape = afterEndField = outerQuote = false;
          afterSeparator = true;
        }
      } else if (c == EOT) {
        if (sb.length() != 0 || afterSeparator || outerQuote) {
          // [...,abc^] => {..., abc}
          // [...,^] => {..., ""}
          endCol(cols, sb, i, outerQuote, afterQuote);
        }
        return cols;
      } else if (c == escape) {
        // [...\...]
        afterEscape = true;
        afterSeparator = false;
      } else if (c == quote) {
        if (afterQuote && outerQuote) {
          // Two consecutive quotes inside quoted string, so the pair has to be internal
          // (the second quote cannot be terminating the field).
          sb.append(quote);
          afterQuote = false;
        } else if (sb.length() == 0 && !outerQuote) {
          outerQuote = true;
        } else if (sb.length() != 0 && !outerQuote) {
          // Fields that are not quote-delimited cannot have any internal quotes,
          // unless they are escaped which was already handled.
          throw new ParseException(escape == NUL
              ? "Unescaped quote inside non-quote-delimited field"
              : "Quote inside non-quote-delimited field",
              i);
        } else {
          afterQuote = true;
        }
        afterSeparator = false;
      } else if (c == ' ' && trim
          && ((!outerQuote && sb.length() == 0) // Trimmed space before field
              || afterEndField)) {              // Trimmed space after field
      } else if (c == ' ' && trim && afterQuote) {
        afterEndField = true;
      } else if (outerQuote && afterQuote) {
        // ["abc"x]
        throw new ParseException("Extraneous character after end of quoted field", i);
      } else {
        // Common character.
        sb.append(c);
        afterSeparator = false;
      }
    }
  }
619359
public static CaptureSearchResult parseCDXLineFlexFast(String line) {	
		CaptureSearchResult result = new FastCaptureSearchResult();
		return parseCDXLineFlex(line, result);
	}
711357
private static String extractContentType(String line) throws IOException {
    // Convert the line to a lowercase string
    line = line.toLowerCase();

    // Get the content type, if any
    // Note that Opera at least puts extra info after the type, so handle
    // that.  For example:  Content-Type: text/plain; name="foo"
    // Thanks to Leon Poyyayil, leon.poyyayil@trivadis.com, for noticing this.
    int end = line.indexOf(";");
    if (end == -1) {
      end = line.length();
    }

    return line.substring(13, end).trim();  // "content-type:" is 13
  }
344367
public static Parser<Void> lineComment(String begin) {
    return Patterns.lineComment(begin).toScanner(begin);
  }
780339
private Value parse(String line) {
        int i = line.indexOf(" : ");
        if (i == -1) {
            throw new IllegalArgumentException("Malformed line in RI Query "
                    + "result (expected ' : ' delimiter): '" + line + "'");
        } else {
            return NTriplesUtil.parseValue(line.substring(i + 3), factory);
        }
    }
715336
public static SimpleDocument parse(String line) {
		String[] splits = line.split("\t");
		if (splits.length < 4)
			return null;
		// ignore first part
		SimpleDocument newdoc = new SimpleDocument();
		try {
			newdoc.label = Integer.parseInt(splits[1]);
			newdoc.totalNumberTokens = Double.parseDouble(splits[2]);
			// num features
			int numfeatures = splits.length - 3;
			newdoc.freqs = new int[numfeatures];
			newdoc.indices = new int[numfeatures];
			int lastPos = 0;
			for (int f = 3; f < splits.length; f++) {
				// x:y
				int sep = splits[f].indexOf(":");
				String pos = splits[f].substring(0, sep);
				String val = splits[f].substring(sep + 1);
				newdoc.indices[lastPos] = Integer.parseInt(pos);
				newdoc.freqs[lastPos] = Integer.parseInt(val);
				lastPos++;
			}
		} catch (Exception e) {
			return null;
		}
		return newdoc;
	}
393111
private int findIndex(String line) {

        int index = -1;

        if (line == null) {
            return index;
        }

        String trimmedLine = line.trim();
        int spaceIndex = trimmedLine.indexOf(" ");
        int tabIndex = trimmedLine.indexOf("\t");

        if (spaceIndex != -1) {
            if (tabIndex != -1) {
                if (spaceIndex < tabIndex) {
                    index = spaceIndex;
                } else {
                    index = tabIndex;
                }
            } else {
                index = spaceIndex;
            }
        } else {
            index = tabIndex;
        }
        return index;
    }
830711
public String getLabel(final String caption, final boolean captizliseFirstLetter) {
		if (captizliseFirstLetter) {
			return JKFormatUtil.capitalizeFirstLetters(getLabel(caption));
		} else {
			return getLabel(caption);
		}
	}