Esempio n. 1
0
  public Document HTMLGetRankedNamedEntities(
      String html, String url, AlchemyAPI_NamedEntityParams params)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException {
    CheckHTML(html, url);

    params.setUrl(url);
    params.setHtml(html);

    return POST("HTMLGetRankedNamedEntities", "html", params);
  }
Esempio n. 2
0
  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);
  }
Esempio n. 3
0
  public String URLGetRankedConcepts(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);

    return POST("URLGetRankedConcepts", "url", params);
  }
Esempio n. 4
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);
  }
Esempio n. 5
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);
  }
Esempio n. 6
0
  public Document TextGetRankedNamedEntities(String text, AlchemyAPI_NamedEntityParams params)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException {
    CheckText(text);

    params.setText(text);

    return POST("TextGetRankedNamedEntities", "text", params);
  }
Esempio n. 7
0
  public Document URLGetRankedNamedEntities(String url, AlchemyAPI_NamedEntityParams params)
      throws IOException, SAXException, ParserConfigurationException, XPathExpressionException {
    CheckURL(url);

    params.setUrl(url);

    return GET("URLGetRankedNamedEntities", "url", params);
  }
Esempio n. 8
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);
  }