Beispiel #1
0
  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);
  }
Beispiel #2
0
  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);
  }
Beispiel #3
0
  public String URLGetRankedKeywords(String url)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException,
          ExtractorDocumentLevelException {
    CheckURL(url);

    AlchemyAPI_NamedEntityParams params = new AlchemyAPI_NamedEntityParams();
    params.setUrl(url);
    params.setOutputMode(AlchemyAPI_NamedEntityParams.OUTPUT_JSON);
    params.setShowSourceText(true);
    if (sentimentEnabled) {
      params.setCustomParameters("sentiment", "1");
    }

    return POST("URLGetRankedKeywords", "url", params);
  }