Exemple #1
0
  public Document TextGetRankedNamedEntities(String text, AlchemyAPI_NamedEntityParams params)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException {
    CheckText(text);

    params.setText(text);

    return POST("TextGetRankedNamedEntities", "text", params);
  }
  public String TextGetRankedConcepts(String text, AlchemyAPI_NamedEntityParams params)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException,
          ExtractorDocumentLevelException {
    CheckText(text);

    params.setText(text);
    params.setOutputMode(AlchemyAPI_NamedEntityParams.OUTPUT_JSON);

    nGetExtractRequests++;
    return POST("TextGetRankedConcepts", "text", params);
  }
  public String TextGetRankedNamedEntities(String text, AlchemyAPI_NamedEntityParams params)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException,
          ExtractorDocumentLevelException {
    CheckText(text);

    params.setText(text);
    params.setOutputMode(AlchemyAPI_NamedEntityParams.OUTPUT_JSON);
    if (sentimentEnabled) {
      params.setCustomParameters("sentiment", "1");
    }

    nGetExtractRequests++;
    return POST("TextGetRankedNamedEntities", "text", params);
  }
  public String TextGetRankedKeywords(String text, AlchemyAPI_NamedEntityParams params)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException,
          ExtractorDocumentLevelException {
    CheckText(text);

    params.setText(text);
    params.setOutputMode(AlchemyAPI_NamedEntityParams.OUTPUT_JSON);
    if (sentimentEnabled) {
      params.setCustomParameters("sentiment", "1");
    }
    if (strict) {
      params.setCustomParameters("keywordExtractMode", "strict");
    }
    if (null != nNumKeywords) {
      params.setCustomParameters("maxRetrieve", Integer.toString(nNumKeywords));
    }
    // Default is normal, not sure which is best
    // params.setCustomParameters("keywordExtractMode", "strict");

    nGetExtractRequests++;
    return POST("TextGetRankedKeywords", "text", params);
  }