パッケージ nlp4j.util

クラス DocumentUtil


  • public class DocumentUtil
    extends Object
    導入されたバージョン:
    1.1
    作成者:
    Hiroki Oya
    • コンストラクタの詳細

      • DocumentUtil

        public DocumentUtil()
    • メソッドの詳細

      • parseFromJson

        public static Document parseFromJson​(String json)
                                      throws Exception
        パラメータ:
        json - to parse
        戻り値:
        Parsed Document
        例外:
        Exception - 例外発生時
        導入されたバージョン:
        1.3.1.0
      • readFromLineSeparatedJson

        public static List<Document> readFromLineSeparatedJson​(File file)
                                                        throws IOException
        read documents from line separated json
        パラメータ:
        file - UTF-8 Line Separated Json File
        戻り値:
        documents parsed from file
        例外:
        IOException - on Error
        導入されたバージョン:
        1.2.1.0
      • toDocument

        public static Document toDocument​(String json)
        Parse Document Object from Json
        パラメータ:
        json - JSON String
        戻り値:
        Instance of DefaultDocument
      • toJsonObject

        public static com.google.gson.JsonObject toJsonObject​(Document doc)
        パラメータ:
        doc - target Document
        戻り値:
        Json String of Document
        導入されたバージョン:
        1.3
      • toJsonObject

        public static com.google.gson.JsonObject toJsonObject​(Keyword kwd)
        パラメータ:
        kwd - target Keyword
        戻り値:
        JsonObject of Keyword
        導入されたバージョン:
        1.1
      • toJsonObject

        public static com.google.gson.JsonObject toJsonObject​(KeywordWithDependency kwd)
        created at: 2022-05-14
        パラメータ:
        kwd -
        戻り値:
      • toJsonObject

        public static com.google.gson.JsonArray toJsonObject​(List<Document> docs)
        パラメータ:
        docs - target Documents
        戻り値:
        Json Array
        導入されたバージョン:
        1.3.1.0
      • toJsonObjectForIndex

        public static com.google.gson.JsonObject toJsonObjectForIndex​(Document doc)
        パラメータ:
        doc - target Document
        戻り値:
        Json String of Document
        導入されたバージョン:
        1.3
      • toJsonPrettyString

        public static String toJsonPrettyString​(List<Document> docs)
        パラメータ:
        docs - target Documents
        戻り値:
        Pretty JSON String of Documents
        導入されたバージョン:
        1.3.1.0
      • toJsonPrettyString

        public static String toJsonPrettyString​(Document doc)
        パラメータ:
        doc - target Document
        戻り値:
        Pretty JSON String of Documents
        導入されたバージョン:
        1.3.2.0
      • toJsonString

        public static String toJsonString​(Document doc)
        パラメータ:
        doc - target Document
        戻り値:
        Json String of Document
        導入されたバージョン:
        1.1
      • toJsonString

        public static String toJsonString​(Keyword kwd)
        パラメータ:
        kwd - target Keyword
        戻り値:
        Json String of Keyword
        導入されたバージョン:
        1.1
      • toJsonString

        public static String toJsonString​(List<Document> docs)
        パラメータ:
        docs - target Documents
        戻り値:
        JSON String of Documents
        導入されたバージョン:
        1.3.1.0
      • toPrettyJsonString

        public static String toPrettyJsonString​(Document doc)
        パラメータ:
        doc - target Document
        戻り値:
        Pretty Json String of Document
        導入されたバージョン:
        1.3.1.0
      • toPrettyJsonStringShort

        public static String toPrettyJsonStringShort​(Document doc)
        パラメータ:
        doc - target Document
        戻り値:
        Pretty Json String of Document in short length
        導入されたバージョン:
        1.3.1.0
      • toXml

        public static String toXml​(Document doc)
        Convert to XML
        パラメータ:
        doc - to be converted
        戻り値:
        XML of document
      • toXml

        public static String toXml​(Keyword kwd)
        Convert to XML
        パラメータ:
        kwd - to be converted
        戻り値:
        XML of Keyword
      • toXmlAttributes

        public static String toXmlAttributes​(Keyword kwd)
        Convert to XML
        パラメータ:
        kwd - to be converted
        戻り値:
        XML of document
      • writeAsLineSeparatedJson

        public static void writeAsLineSeparatedJson​(Document doc,
                                                    File file)
                                             throws IOException
        Write documents as Line Separated Json
        パラメータ:
        doc - Document to write to file
        file - to write
        例外:
        IOException - on error writing file
        導入されたバージョン:
        1.2.1.0
      • writeAsLineSeparatedJson

        public static void writeAsLineSeparatedJson​(List<Document> docs,
                                                    File file)
                                             throws IOException
        Write documents as Line Separated Json
        パラメータ:
        docs - Document to write to file
        file - to write
        例外:
        IOException - on error writing file
        導入されたバージョン:
        1.2.1.0