• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AlchemyAPI类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.alchemyapi.api.AlchemyAPI的典型用法代码示例。如果您正苦于以下问题:Java AlchemyAPI类的具体用法?Java AlchemyAPI怎么用?Java AlchemyAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

AlchemyAPI类属于com.alchemyapi.api包,在下文中一共展示了AlchemyAPI类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTextInFileOutPut

点赞 3

import com.alchemyapi.api.AlchemyAPI; //导入依赖的package包/类
public static void getTextInFileOutPut(String search, int nbResult, int longueur) throws ParserConfigurationException, TransformerFactoryConfigurationError, TransformerException, FileNotFoundException, IOException, BadLocationException
{
	ArrayList<String> list = getURLs(search, nbResult);
	ArrayList<Document> listDoc = new ArrayList<Document>();
	
	Iterator<String> it = list.iterator();
	
	// Create an AlchemyAPI object.
       AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile(API_KEY);
	
	while (it.hasNext())
	
		// Extract page text from a web URL. (ignoring ads, navigation links,
        // and other content).
		try
		{
			listDoc.add(alchemyObj.URLGetText(it.next()));
		}
		catch (Exception e)
		{}
	
	// G�n�rer le fichier xml
	SerialiseurXML.getInstance().saveFile(listDoc,search,longueur);
}
 

开发者ID:HugoBA,
项目名称:SemanticWeb,
代码行数:25,
代码来源:ExtractURL.java

示例2: HALHandler

点赞 2

import com.alchemyapi.api.AlchemyAPI; //导入依赖的package包/类
public HALHandler(KnowledgeGraph KG) {
    super(KG);
    
    alchemyAPI = AlchemyAPI.GetInstanceFromString("093cf54dbd973d85666e8b401838beb3294547af");
    alchemyParser = new AlchemyResultParser();
    
    tmpAnnotations = new ArrayList<>();
    tmpAuthors = new ArrayList<>();
    
    alchemyAgent = (ArtificialAgent) KG.getNamedObject("Alchemy API");
    if(alchemyAgent == null)
        alchemyAgent = new ArtificialAgent("Alchemy API");
}
 

开发者ID:sifrproject,
项目名称:viewpoints_io,
代码行数:14,
代码来源:HALHandler.java

示例3: getText

点赞 2

import com.alchemyapi.api.AlchemyAPI; //导入依赖的package包/类
private String getText()
throws  IOException, 
        SAXException, 
        ParserConfigurationException, 
        XPathExpressionException
{
    // Create an AlchemyAPI object.
    System.out.println(PropFactory.config.getProperty("fr.eurecom.nerd.extractor.alchemyapi.key"));
    AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromString("3420f889c255a95339bd0b5ee64d5f478b2c61bf");

    // Extract page text from a web URL. (ignoring ads, navigation links, and other content).
    Document doc = null; 
    try{ 
        doc = alchemyObj.URLGetText(this.URI);
        doc.getDocumentElement().normalize();
    } catch(Exception e) {      
        e.printStackTrace();
    }
    NodeList nList = doc.getElementsByTagName("text").item(0).getChildNodes();
    Node txtNode = nList.item(0);
    
    if(txtNode == null)
        return null;
    
    text = txtNode.getNodeValue();
    return text;
}
 

开发者ID:NERD-project,
项目名称:nerd-api,
代码行数:28,
代码来源:HTMLScraper.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)