[英]How to extract the keyword properties of a PDF URL using IBM Watson Explorer?
我想從PDF鏈接中提取PDF的關鍵字值。 我正在爬一個包含一些PDF鏈接的頁面。 我想建立一個虛擬文檔,在其中必須將那些PDF放入隊列。 我不想抓取這些PDF的內容,但是我只想從這些PDF中提取關鍵字。 當我打開帶有檢查源的PDF鏈接時,它確實有一個關鍵字字段。 但是它沒有關鍵字的任何值。 看起來像這樣:
<div class="row">
<span data-l10n-id="document_properties_keywords">Keywords:</span> <p id="keywordsField">-</p>
</div>
有什么方法可以從PDF中提取關鍵字嗎? 我看到那些PDF具有關鍵字,當我下載這些PDF時,打開PDF屬性和關鍵字具有一定的價值。
參考: https : //www.ibm.com/support/knowledgecenter/SS8NLW_10.0.0/com.ibm.swg.im.infosphere.dataexpl.engine.tut.virt.doc/t_cc-build-virt-docs.html
我不知道開箱即用的方法,但是您可以嘗試實現搜尋器插件或自己的搜尋器。 有一些鈎子可以添加提取元數據並將其添加到索引,例如,在搜尋器插件中,您可以執行以下操作
@Override
public CrawledData updateDocument(CrawledData crawledData) throws CrawlerPluginException {
List<FieldMetadata> metadataList = crawledData.getMetadataList();
String MyPDFProperty= getFromOriginalContent(crawledData.getOriginalContents());
//getFromOriginalContent method you need to implement for your PDF document
if (metadataList == null) {
metadataList = new ArrayList<FieldMetadata>();
}
FieldMetadata pdfFieldMetaData = new FieldMetadata("pdfextractedpropertyr", MyPDFProperty);
metadataList.add(pdfFieldMetaData);
crawledData.setMetadataList(metadataList);
} catch (ClientServicesException e) {
logger.error(e.getMessage());
throw new CrawlerPluginException(e);
}
}
return crawledData;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.