├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── libraries │ ├── Maven__aopalliance_aopalliance_1_0.xml │ ├── Maven__com_alibaba_fastjson_1_1_39.xml │ ├── Maven__com_clearspring_analytics_stream_2_7_0.xml │ ├── Maven__com_github_jai_imageio_jai_imageio_core_1_3_0.xml │ ├── Maven__com_google_code_findbugs_annotations_2_0_1.xml │ ├── Maven__com_google_code_findbugs_jsr305_1_3_9.xml │ ├── Maven__com_google_guava_guava_11_0.xml │ ├── Maven__com_google_protobuf_protobuf_java_2_5_0.xml │ ├── Maven__com_googlecode_protobuf_java_format_protobuf_java_format_1_2.xml │ ├── Maven__com_huaban_jieba_analysis_1_0_2.xml │ ├── Maven__com_twelvemonkeys_common_common_image_3_1_1.xml │ ├── Maven__com_twelvemonkeys_common_common_io_3_1_1.xml │ ├── Maven__com_twelvemonkeys_common_common_lang_3_1_1.xml │ ├── Maven__com_twelvemonkeys_imageio_imageio_bmp_3_1_1.xml │ ├── Maven__com_twelvemonkeys_imageio_imageio_core_3_1_1.xml │ ├── Maven__com_twelvemonkeys_imageio_imageio_jpeg_3_1_1.xml │ ├── Maven__com_twelvemonkeys_imageio_imageio_metadata_3_1_1.xml │ ├── Maven__com_twelvemonkeys_imageio_imageio_psd_3_1_1.xml │ ├── Maven__com_twelvemonkeys_imageio_imageio_tiff_3_1_1.xml │ ├── Maven__com_yammer_metrics_metrics_core_2_2_0.xml │ ├── Maven__commons_codec_commons_codec_1_10.xml │ ├── Maven__commons_dbcp_commons_dbcp_1_2_2.xml │ ├── Maven__commons_io_commons_io_2_4.xml │ ├── Maven__commons_lang_commons_lang_2_6.xml │ ├── Maven__commons_logging_commons_logging_1_1_3.xml │ ├── Maven__commons_net_commons_net_3_1.xml │ ├── Maven__commons_pool_commons_pool_1_3.xml │ ├── Maven__io_netty_netty_3_7_0_Final.xml │ ├── Maven__it_unimi_dsi_fastutil_6_5_7.xml │ ├── Maven__jline_jline_0_9_94.xml │ ├── Maven__joda_time_joda_time_2_2.xml │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__log4j_log4j_1_2_17.xml │ ├── Maven__net_ericaro_neoitertools_1_0_0.xml │ ├── Maven__net_jpountz_lz4_lz4_1_2_0.xml │ ├── Maven__net_sf_jopt_simple_jopt_simple_3_2.xml │ ├── Maven__org_apache_ant_ant_1_9_1.xml │ ├── Maven__org_apache_ant_ant_launcher_1_9_1.xml │ ├── Maven__org_apache_commons_commons_compress_1_8.xml │ ├── Maven__org_apache_commons_commons_lang3_3_3_1.xml │ ├── Maven__org_apache_commons_commons_math3_3_4_1.xml │ ├── Maven__org_apache_directory_studio_org_apache_commons_codec_1_8.xml │ ├── Maven__org_apache_kafka_kafka_2_10_0_8_2_1.xml │ ├── Maven__org_apache_kafka_kafka_clients_0_8_2_1.xml │ ├── Maven__org_apache_opennlp_opennlp_tools_1_8_1.xml │ ├── Maven__org_apache_zookeeper_zookeeper_3_4_6.xml │ ├── Maven__org_bytedeco_javacpp_1_3_2.xml │ ├── Maven__org_bytedeco_javacpp_presets_artoolkitplus_2_3_1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_ffmpeg_3_2_1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_flandmark_1_07_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_flycapture_2_9_3_43_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_linux_ppc64le_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_linux_x86_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_linux_x86_64_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_macosx_x86_64_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_platform_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_windows_x86_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_hdf5_windows_x86_64_1_10_0_patch1_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_android_arm_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_android_x86_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_linux_armhf_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_linux_ppc64le_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_linux_x86_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_linux_x86_64_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_macosx_x86_64_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_platform_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_windows_x86_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_leptonica_windows_x86_64_1_73_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_libdc1394_2_2_4_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_libfreenect2_0_2_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_libfreenect_0_5_3_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_librealsense_1_9_6_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_android_arm_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_android_x86_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_linux_armhf_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_linux_ppc64le_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_linux_x86_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_linux_x86_64_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_macosx_x86_64_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_platform_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_windows_x86_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_openblas_windows_x86_64_0_2_19_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_android_arm_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_android_x86_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_linux_armhf_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_linux_ppc64le_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_linux_x86_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_linux_x86_64_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_macosx_x86_64_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_platform_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_windows_x86_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_opencv_windows_x86_64_3_1_0_1_3.xml │ ├── Maven__org_bytedeco_javacpp_presets_videoinput_0_200_1_3.xml │ ├── Maven__org_bytedeco_javacv_1_3_1.xml │ ├── Maven__org_codehaus_woodstox_stax2_api_3_1_4.xml │ ├── Maven__org_datavec_datavec_api_0_8_0.xml │ ├── Maven__org_datavec_datavec_data_image_0_8_0.xml │ ├── Maven__org_datavec_datavec_nd4j_common_0_8_0.xml │ ├── Maven__org_deeplearning4j_deeplearning4j_core_0_8_0.xml │ ├── Maven__org_deeplearning4j_deeplearning4j_modelimport_0_8_0.xml │ ├── Maven__org_deeplearning4j_deeplearning4j_nlp_0_8_0.xml │ ├── Maven__org_deeplearning4j_deeplearning4j_nn_0_8_0.xml │ ├── Maven__org_deeplearning4j_deeplearning4j_ui_components_0_8_0.xml │ ├── Maven__org_freemarker_freemarker_2_3_23.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__org_javassist_javassist_3_19_0_GA.xml │ ├── Maven__org_json_json_20131018.xml │ ├── Maven__org_mybatis_mybatis_3_2_6.xml │ ├── Maven__org_mybatis_mybatis_spring_1_3_1.xml │ ├── Maven__org_nd4j_jackson_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_api_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_base64_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_buffer_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_common_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_context_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_jackson_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_android_arm_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_android_x86_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_api_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_linux_ppc64le_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_linux_x86_64_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_macosx_x86_64_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_platform_0_8_0.xml │ ├── Maven__org_nd4j_nd4j_native_windows_x86_64_0_8_0.xml │ ├── Maven__org_projectlombok_lombok_1_16_10.xml │ ├── Maven__org_reflections_reflections_0_9_10.xml │ ├── Maven__org_scala_lang_scala_library_2_10_4.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_12.xml │ ├── Maven__org_slf4j_slf4j_log4j12_1_6_1.xml │ ├── Maven__org_springframework_spring_aop_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_context_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_context_support_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_core_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_expression_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_test_4_1_1_RELEASE.xml │ ├── Maven__org_springframework_spring_tx_4_1_1_RELEASE.xml │ ├── Maven__org_tukaani_xz_1_5.xml │ └── Maven__org_yaml_snakeyaml_1_12.xml ├── misc.xml ├── modules.xml ├── uiDesigner.xml ├── vcs.xml └── workspace.xml ├── README.md ├── TextAnalysis.iml ├── pom.xml └── src ├── main ├── java │ └── textanalysis │ │ ├── InputPath.java │ │ ├── Learn.java │ │ ├── MLlibPredict.java │ │ ├── PredictFactory.java │ │ ├── PredictModel.java │ │ ├── ReadJsonFile.java │ │ ├── SentencePredcit.java │ │ ├── TextAnalysis.java │ │ ├── Word2VEC.java │ │ ├── WordPredict.java │ │ ├── WordScordPredict2.java │ │ ├── WordScordPredict3.java │ │ ├── WordScorePredict.java │ │ ├── domain │ │ ├── HiddenNeuron.java │ │ ├── Neuron.java │ │ ├── WordEntry.java │ │ └── WordNeuron.java │ │ ├── svm_predict.java │ │ ├── svm_scale.java │ │ ├── svm_toy.java │ │ ├── svm_train.java │ │ └── util │ │ ├── Haffman.java │ │ ├── MapCount.java │ │ └── WordKmeans.java └── resources │ ├── stop_words.ml │ ├── vector.mod │ └── 中文停用词库2.ml └── test └── java └── textanalysis ├── SentencePredcitTest.java ├── SentencePredict.java ├── SentencePredictMlib.java ├── SentencePredictScord.java ├── SentencePredictScord2.java └── SentencePredictScord3.java /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_fastjson_1_1_39.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_clearspring_analytics_stream_2_7_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_jai_imageio_jai_imageio_core_1_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_findbugs_jsr305_1_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_guava_guava_11_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_protobuf_protobuf_java_2_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_googlecode_protobuf_java_format_protobuf_java_format_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_huaban_jieba_analysis_1_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_common_common_image_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_common_common_io_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_common_common_lang_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_imageio_imageio_bmp_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_imageio_imageio_core_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_imageio_imageio_jpeg_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_imageio_imageio_metadata_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_imageio_imageio_psd_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_twelvemonkeys_imageio_imageio_tiff_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_yammer_metrics_metrics_core_2_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_codec_commons_codec_1_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_dbcp_commons_dbcp_1_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_io_commons_io_2_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_logging_commons_logging_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_net_commons_net_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_pool_commons_pool_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_3_7_0_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__it_unimi_dsi_fastutil_6_5_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jline_jline_0_9_94.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__joda_time_joda_time_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__log4j_log4j_1_2_17.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_ericaro_neoitertools_1_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_jpountz_lz4_lz4_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_sf_jopt_simple_jopt_simple_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ant_ant_1_9_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ant_ant_launcher_1_9_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_compress_1_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_math3_3_4_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_directory_studio_org_apache_commons_codec_1_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_kafka_kafka_2_10_0_8_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_kafka_kafka_clients_0_8_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_opennlp_opennlp_tools_1_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_zookeeper_zookeeper_3_4_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_artoolkitplus_2_3_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_ffmpeg_3_2_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_flandmark_1_07_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_flycapture_2_9_3_43_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_linux_ppc64le_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_linux_x86_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_linux_x86_64_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_macosx_x86_64_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_platform_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_windows_x86_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_hdf5_windows_x86_64_1_10_0_patch1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_android_arm_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_android_x86_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_linux_armhf_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_linux_ppc64le_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_linux_x86_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_linux_x86_64_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_macosx_x86_64_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_platform_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_windows_x86_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_leptonica_windows_x86_64_1_73_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_libdc1394_2_2_4_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_libfreenect2_0_2_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_libfreenect_0_5_3_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_librealsense_1_9_6_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_android_arm_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_android_x86_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_linux_armhf_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_linux_ppc64le_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_linux_x86_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_linux_x86_64_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_macosx_x86_64_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_platform_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_windows_x86_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_openblas_windows_x86_64_0_2_19_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_android_arm_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_android_x86_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_linux_armhf_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_linux_ppc64le_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_linux_x86_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_linux_x86_64_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_macosx_x86_64_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_platform_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_windows_x86_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_opencv_windows_x86_64_3_1_0_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacpp_presets_videoinput_0_200_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_bytedeco_javacv_1_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_codehaus_woodstox_stax2_api_3_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_datavec_datavec_api_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_datavec_datavec_data_image_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_datavec_datavec_nd4j_common_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_deeplearning4j_deeplearning4j_core_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_deeplearning4j_deeplearning4j_modelimport_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_deeplearning4j_deeplearning4j_nlp_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_deeplearning4j_deeplearning4j_nn_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_deeplearning4j_deeplearning4j_ui_components_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_freemarker_freemarker_2_3_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_javassist_javassist_3_19_0_GA.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_json_json_20131018.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_3_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_spring_1_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_jackson_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_api_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_base64_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_buffer_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_common_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_context_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_jackson_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_android_arm_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_android_x86_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_api_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_linux_ppc64le_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_linux_x86_64_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_macosx_x86_64_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_platform_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_nd4j_nd4j_native_windows_x86_64_0_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_projectlombok_lombok_1_16_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_scala_lang_scala_library_2_10_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_support_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jdbc_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_4_1_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_tukaani_xz_1_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_yaml_snakeyaml_1_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TextAnalysisz 2 | 中文语义分析(用两种方法----中文极性词典NTUSD 和 机器学习): 3 | 基于平台(java + jieba分词 + word2Vec + libsvm ) 4 | 1.基于中文极性词典(NTUSD): 5 | sentence 通过结巴分词然后和中文极性词库进行对比,判断这段话的情感性别。 6 | 7 | 2.基于机器学习的语义分析: 8 | sentence 通过结巴分词,然后word2vec转换成向量,然后训练libsvm, 对测试语句同样转换成向量,利用libsvm进行预测。 9 | 10 | 3.尝试加入词权的分析: 11 |  基于BosonNLP词典进行中文语义分析。(情感词+否定词+程度副词) 12 | 13 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 4.0.0 7 | com.sdyc.data720 8 | data720-cls 9 | 0.1.0 10 | jar 11 | NowledgeData 720Data 正负判断 12 | http://www.nowledgedata.com.cn/ 13 | 14 | 15 | 4.1.1.RELEASE 16 | 17 | 18 | 19 | 20 | 21 | aliyun 22 | Maven Repository Switchboard 23 | default 24 | http://maven.aliyun.com/nexus/service/local/repositories/central/content/ 25 | 26 | false 27 | 28 | 29 | 30 | 31 | sdyc 32 | sdyc Maven Central 33 | default 34 | http://192.168.1.114:8081/nexus/content/groups/public/ 35 | 36 | true 37 | daily 38 | 39 | 40 | false 41 | 42 | 43 | 44 | 45 | central 46 | Maven Central 47 | default 48 | http://repo.maven.apache.org/maven2/ 49 | 50 | false 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | junit 60 | junit 61 | 4.12 62 | test 63 | 64 | 65 | 66 | com.huaban 67 | jieba-analysis 68 | 1.0.2 69 | 70 | 71 | 72 | org.apache.opennlp 73 | opennlp-tools 74 | 1.8.1 75 | 76 | 77 | 78 | org.deeplearning4j 79 | deeplearning4j-core 80 | 0.8.0 81 | 82 | 83 | 84 | org.deeplearning4j 85 | deeplearning4j-nlp 86 | 0.8.0 87 | 88 | 89 | 90 | org.nd4j 91 | nd4j-native-platform 92 | 0.8.0 93 | test 94 | 95 | 96 | 97 | 98 | log4j 99 | log4j 100 | 1.2.17 101 | 102 | 103 | 104 | com.google.protobuf 105 | protobuf-java 106 | 2.5.0 107 | 108 | 109 | 110 | org.springframework 111 | spring-core 112 | ${spring.version} 113 | 114 | 115 | 116 | org.springframework 117 | spring-beans 118 | ${spring.version} 119 | 120 | 121 | 122 | org.springframework 123 | spring-context 124 | ${spring.version} 125 | 126 | 127 | 128 | org.springframework 129 | spring-context-support 130 | ${spring.version} 131 | 132 | 133 | 134 | org.springframework 135 | spring-tx 136 | ${spring.version} 137 | 138 | 139 | 140 | org.springframework 141 | spring-aop 142 | ${spring.version} 143 | 144 | 145 | 146 | org.springframework 147 | spring-jdbc 148 | ${spring.version} 149 | 150 | 151 | 152 | org.springframework 153 | spring-test 154 | ${spring.version} 155 | test 156 | true 157 | 158 | 159 | 160 | com.googlecode.protobuf-java-format 161 | protobuf-java-format 162 | 1.2 163 | 164 | 165 | 166 | 167 | org.mybatis 168 | mybatis-spring 169 | 1.3.1 170 | 171 | 172 | 173 | org.mybatis 174 | mybatis 175 | 3.2.6 176 | 177 | 178 | 179 | commons-dbcp 180 | commons-dbcp 181 | 1.2.2 182 | 183 | 184 | 185 | org.apache.kafka 186 | kafka_2.10 187 | 0.8.2.1 188 | 189 | 190 | log4j 191 | log4j 192 | 193 | 194 | zkclient 195 | com.101tec 196 | 197 | 198 | snappy-java 199 | org.xerial.snappy 200 | 201 | 205 | 206 | 207 | 208 | 209 | com.alibaba 210 | fastjson 211 | 1.1.39 212 | 213 | 214 | 215 | org.apache.ant 216 | ant 217 | 1.9.1 218 | 219 | 220 | org.springframework 221 | spring-test 222 | 4.1.1.RELEASE 223 | 224 | 225 | 226 | 227 | 228 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/InputPath.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | /** 4 | * Created by sssd on 2017/7/18. 5 | */ 6 | public class InputPath { 7 | 8 | //词典匹配 9 | public String path; // word-score 的路径(wordScore) 10 | 11 | //libsvm 12 | public String negPATH; //neg 的路径 13 | public String posPath; //pos 的路径 14 | 15 | //词权 + 否定词 + 程度副词 16 | public String emotionPath; 17 | public String denyPath; 18 | public String levelPath; 19 | 20 | public String getStopWordPath() { 21 | return stopWordPath; 22 | } 23 | 24 | public void setStopWordPath(String stopWordPath) { 25 | this.stopWordPath = stopWordPath; 26 | } 27 | 28 | public String stopWordPath; 29 | 30 | 31 | public String getEmotionPath() { 32 | return emotionPath; 33 | } 34 | 35 | public void setEmotionPath(String emotionPath) { 36 | this.emotionPath = emotionPath; 37 | } 38 | 39 | public String getDenyPath() { 40 | return denyPath; 41 | } 42 | 43 | public void setDenyPath(String denyPath) { 44 | this.denyPath = denyPath; 45 | } 46 | 47 | public String getLevelPath() { 48 | return levelPath; 49 | } 50 | 51 | public void setLevelPath(String levelPath) { 52 | this.levelPath = levelPath; 53 | } 54 | 55 | public String getPath() { 56 | return path; 57 | } 58 | 59 | public void setPath(String path) { 60 | this.path = path; 61 | } 62 | 63 | 64 | public String getNegPATH() { 65 | return negPATH; 66 | } 67 | 68 | public void setNegPATH(String negPATH) { 69 | this.negPATH = negPATH; 70 | } 71 | 72 | public String getPosPath() { 73 | return posPath; 74 | } 75 | 76 | public void setPosPath(String posPath) { 77 | this.posPath = posPath; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/MLlibPredict.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import java.io.BufferedWriter; 4 | import java.io.File; 5 | import java.io.FileWriter; 6 | import java.util.*; 7 | 8 | /** 9 | * Created by sssd on 2017/7/18. 10 | */ 11 | public class MLlibPredict implements PredictModel { 12 | 13 | protected TextAnalysis textAnalysis = new TextAnalysis(); 14 | protected List wordDatas = new ArrayList(); 15 | 16 | public void init(InputPath inputPath)throws Exception { 17 | 18 | //读取文本,返回map<标签,文本> 19 | String negPath = inputPath.getNegPATH(); 20 | String posPath = inputPath.getPosPath(); 21 | Map textMap = textAnalysis.readText(negPath); 22 | Map posTextMap = textAnalysis.readText(posPath); 23 | textMap.putAll(posTextMap); 24 | 25 | 26 | //存放分词后的文档用来训练word2vec 27 | String splitWordPath ="src/main/resources/tokenizerResult.ml"; 28 | String word2vecPath ="src/main/resources/vector.mod"; 29 | StringBuffer textCombine = new StringBuffer(); 30 | BufferedWriter bw = new BufferedWriter(new FileWriter(new File(splitWordPath))); 31 | Iterator iterator=textMap.keySet().iterator(); 32 | while(iterator.hasNext()){ 33 | Object key=iterator.next(); 34 | textCombine.append(textMap.get(key).toString()).append("\n"); 35 | } 36 | textCombine.deleteCharAt(textCombine.length()-1); 37 | bw.write(textCombine.toString()); 38 | bw.close(); 39 | textAnalysis.initWord2Vec(splitWordPath,word2vecPath); //训练word2vec 40 | wordDatas = textAnalysis.text2Vec(textMap,4); //将文本转换成向量(50允许文本的长度) 41 | List allDatas = textAnalysis.dataComple(wordDatas); // 数据补全 42 | 43 | //保存成svm的数据类型 44 | String savaTrainPath = "src/main/resources/libsvmtrain.ml"; 45 | String savaModelPath = "src/main/resources/model.ml"; 46 | textAnalysis.data2Svm(savaTrainPath,allDatas); 47 | //模型训练及预测 48 | String[] arg = { savaTrainPath,savaModelPath }; 49 | svm_train.main(arg); 50 | } 51 | 52 | public List predict(String sentence )throws Exception { 53 | String tetxSplits = TextAnalysis.getSplitWord(sentence); 54 | HashMap senMap = new HashMap(); 55 | senMap.put(1,tetxSplits); 56 | ListtestWordDatas = textAnalysis.text2Vec(senMap,4); // 转换文本为向量 ,10表示的是文本的阈值 57 | List allDatas = textAnalysis.dataComple(testWordDatas,wordDatas.get(0).size()); // 数据补全 58 | String saveTestPath = "src/main/resources/libsvmtest.ml"; 59 | String savePredictPath = "src/main/resources/libsvmpredict.ml"; 60 | textAnalysis.data2Svm(saveTestPath,allDatas); 61 | String savaModelPath = "src/main/resources/model.ml"; 62 | String[] parg = {saveTestPath,savaModelPath,savePredictPath}; 63 | List predictLabel = svm_predict.main(parg); 64 | return predictLabel; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/PredictFactory.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | /** 4 | * Created by sssd on 2017/7/18. 5 | */ 6 | public class PredictFactory { 7 | 8 | public static PredictModel newInstance( int method){ 9 | if ( method ==1 ){ 10 | return new MLlibPredict(); 11 | }else if (method == 2) { 12 | return new WordPredict(); 13 | }else if (method ==3){ 14 | return new WordScorePredict(); 15 | }else if (method == 4){ 16 | return new WordScordPredict2(); 17 | }else{ 18 | return new WordScordPredict3(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/PredictModel.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by sssd on 2017/7/18. 7 | */ 8 | public interface PredictModel { 9 | public void init(InputPath inputPath)throws Exception; 10 | public List predict(String sentence ) throws Exception; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/ReadJsonFile.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import org.json.JSONObject; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.File; 7 | import java.io.FileReader; 8 | import java.io.IOException; 9 | import java.util.LinkedHashMap; 10 | import java.util.Map; 11 | 12 | /** 13 | * Created by sssd on 2017/7/17. 14 | */ 15 | public class ReadJsonFile { 16 | 17 | public static Map readJsonFile(String jsonPath) throws Exception{ 18 | Map textMap = new LinkedHashMap(); 19 | File file = new File(jsonPath); 20 | BufferedReader reader = null; 21 | StringBuffer laststr = new StringBuffer(); 22 | reader = new BufferedReader(new FileReader(file)); 23 | String tempString = null; 24 | //一次读入一行,直到读入null为文件结束 25 | while ((tempString = reader.readLine()) != null) { 26 | JSONObject jo= new JSONObject(tempString); 27 | if (jo.has("content")){ 28 | laststr.append(jo.getString("content")).append("\n"); 29 | } 30 | } 31 | laststr.deleteCharAt(laststr.length()-1); 32 | reader.close(); 33 | textMap.put(1,laststr.toString()); 34 | return textMap; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/SentencePredcit.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by sssd on 2017/7/18. 7 | */ 8 | public class SentencePredcit { 9 | protected PredictModel predictModel; 10 | 11 | public void initTrain( int method, InputPath inputPath) throws Exception { 12 | predictModel = PredictFactory.newInstance(method); 13 | predictModel.init(inputPath); 14 | } 15 | public List sensePredict(String sentecne)throws Exception{ 16 | List preLabel = predictModel.predict(sentecne); 17 | return preLabel; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/Word2VEC.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import textanalysis.domain.WordEntry; 4 | 5 | import java.io.*; 6 | import java.util.*; 7 | import java.util.Map.Entry; 8 | 9 | 10 | public class Word2VEC { 11 | 12 | public static void main(String[] args) throws IOException { 13 | 14 | // Learn learn = new Learn(); 15 | // learn.learnFile(new File("library/xh.txt")); 16 | // learn.saveModel(new File("library/javaSkip1")); 17 | 18 | Word2VEC vec = new Word2VEC(); 19 | vec.loadJavaModel("library/javaSkip1"); 20 | 21 | // System.out.println("中国" + "\t" + 22 | // Arrays.toString(vec.getWordVector("中国"))); 23 | // ; 24 | // System.out.println("毛泽东" + "\t" + 25 | // Arrays.toString(vec.getWordVector("毛泽东"))); 26 | // ; 27 | // System.out.println("足球" + "\t" + 28 | // Arrays.toString(vec.getWordVector("足球"))); 29 | 30 | // Word2VEC vec2 = new Word2VEC(); 31 | // vec2.loadGoogleModel("library/vectors.bin") ; 32 | // 33 | // 34 | String str = "毛泽东"; 35 | long start = System.currentTimeMillis(); 36 | for (int i = 0; i < 100; i++) { 37 | System.out.println(vec.distance(str)); 38 | ; 39 | } 40 | System.out.println(System.currentTimeMillis() - start); 41 | 42 | System.out.println(System.currentTimeMillis() - start); 43 | // System.out.println(vec2.distance(str)); 44 | // 45 | // 46 | // //男人 国王 女人 47 | // System.out.println(vec.analogy("邓小平", "毛泽东思想", "毛泽东")); 48 | // System.out.println(vec2.analogy("毛泽东", "毛泽东思想", "邓小平")); 49 | } 50 | 51 | private HashMap wordMap = new HashMap(); 52 | 53 | private int words; 54 | private int size; 55 | private int topNSize = 40; 56 | 57 | /** 58 | * 加载模型 59 | * 60 | * @param path 61 | * 模型的路径 62 | * @throws IOException 63 | */ 64 | public void loadGoogleModel(String path) throws IOException { 65 | DataInputStream dis = null; 66 | BufferedInputStream bis = null; 67 | double len = 0; 68 | float vector = 0; 69 | try { 70 | bis = new BufferedInputStream(new FileInputStream(path)); 71 | dis = new DataInputStream(bis); 72 | // //读取词数 73 | words = Integer.parseInt(readString(dis)); 74 | // //大小 75 | size = Integer.parseInt(readString(dis)); 76 | String word; 77 | float[] vectors = null; 78 | for (int i = 0; i < words; i++) { 79 | word = readString(dis); 80 | vectors = new float[size]; 81 | len = 0; 82 | for (int j = 0; j < size; j++) { 83 | vector = readFloat(dis); 84 | len += vector * vector; 85 | vectors[j] = (float) vector; 86 | } 87 | len = Math.sqrt(len); 88 | 89 | for (int j = 0; j < size; j++) { 90 | vectors[j] /= len; 91 | } 92 | 93 | wordMap.put(word, vectors); 94 | dis.read(); 95 | } 96 | } finally { 97 | bis.close(); 98 | dis.close(); 99 | } 100 | } 101 | 102 | /** 103 | * 加载模型 104 | * 105 | * @param path 106 | * 模型的路径 107 | * @throws IOException 108 | */ 109 | public void loadJavaModel(String path) throws IOException { 110 | DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(path))); 111 | if ( dis != null ) { 112 | words = dis.readInt(); 113 | size = dis.readInt(); 114 | 115 | float vector = 0; 116 | 117 | String key = null; 118 | float[] value = null; 119 | for (int i = 0; i < words; i++) { 120 | double len = 0; 121 | try { 122 | key = dis.readUTF(); 123 | value = new float[size]; 124 | for (int j = 0; j < size; j++) { 125 | vector = dis.readFloat(); 126 | len += vector * vector; 127 | value[j] = vector; 128 | } 129 | 130 | len = Math.sqrt(len); 131 | 132 | for (int j = 0; j < size; j++) { 133 | value[j] /= len; 134 | } 135 | wordMap.put(key, value); 136 | } catch (EOFException e) { 137 | continue; 138 | } 139 | } 140 | 141 | } 142 | } 143 | 144 | private static final int MAX_SIZE = 50; 145 | 146 | /** 147 | * 近义词 148 | * 149 | * @return 150 | */ 151 | public TreeSet analogy(String word0, String word1, String word2) { 152 | float[] wv0 = getWordVector(word0); 153 | float[] wv1 = getWordVector(word1); 154 | float[] wv2 = getWordVector(word2); 155 | 156 | if (wv1 == null || wv2 == null || wv0 == null) { 157 | return null; 158 | } 159 | float[] wordVector = new float[size]; 160 | for (int i = 0; i < size; i++) { 161 | wordVector[i] = wv1[i] - wv0[i] + wv2[i]; 162 | } 163 | float[] tempVector; 164 | String name; 165 | List wordEntrys = new ArrayList(topNSize); 166 | for (Entry entry : wordMap.entrySet()) { 167 | name = entry.getKey(); 168 | if (name.equals(word0) || name.equals(word1) || name.equals(word2)) { 169 | continue; 170 | } 171 | float dist = 0; 172 | tempVector = entry.getValue(); 173 | for (int i = 0; i < wordVector.length; i++) { 174 | dist += wordVector[i] * tempVector[i]; 175 | } 176 | insertTopN(name, dist, wordEntrys); 177 | } 178 | return new TreeSet(wordEntrys); 179 | } 180 | 181 | private void insertTopN(String name, float score, List wordsEntrys) { 182 | // TODO Auto-generated method stub 183 | if (wordsEntrys.size() < topNSize) { 184 | wordsEntrys.add(new WordEntry(name, score)); 185 | return; 186 | } 187 | float min = Float.MAX_VALUE; 188 | int minOffe = 0; 189 | for (int i = 0; i < topNSize; i++) { 190 | WordEntry wordEntry = wordsEntrys.get(i); 191 | if (min > wordEntry.score) { 192 | min = wordEntry.score; 193 | minOffe = i; 194 | } 195 | } 196 | 197 | if (score > min) { 198 | wordsEntrys.set(minOffe, new WordEntry(name, score)); 199 | } 200 | 201 | } 202 | 203 | public Set distance(String queryWord) { 204 | 205 | float[] center = wordMap.get(queryWord); 206 | if (center == null) { 207 | return Collections.emptySet(); 208 | } 209 | 210 | int resultSize = wordMap.size() < topNSize ? wordMap.size() : topNSize; 211 | TreeSet result = new TreeSet(); 212 | 213 | double min = Float.MIN_VALUE; 214 | for (Entry entry : wordMap.entrySet()) { 215 | float[] vector = entry.getValue(); 216 | float dist = 0; 217 | for (int i = 0; i < vector.length; i++) { 218 | dist += center[i] * vector[i]; 219 | } 220 | 221 | if (dist > min) { 222 | result.add(new WordEntry(entry.getKey(), dist)); 223 | if (resultSize < result.size()) { 224 | result.pollLast(); 225 | } 226 | min = result.last().score; 227 | } 228 | } 229 | result.pollFirst(); 230 | 231 | return result; 232 | } 233 | 234 | public Set distance(List words) { 235 | 236 | float[] center = null; 237 | for (String word : words) { 238 | center = sum(center, wordMap.get(word)); 239 | } 240 | 241 | if (center == null) { 242 | return Collections.emptySet(); 243 | } 244 | 245 | int resultSize = wordMap.size() < topNSize ? wordMap.size() : topNSize; 246 | TreeSet result = new TreeSet(); 247 | 248 | double min = Float.MIN_VALUE; 249 | for (Entry entry : wordMap.entrySet()) { 250 | float[] vector = entry.getValue(); 251 | float dist = 0; 252 | for (int i = 0; i < vector.length; i++) { 253 | dist += center[i] * vector[i]; 254 | } 255 | 256 | if (dist > min) { 257 | result.add(new WordEntry(entry.getKey(), dist)); 258 | if (resultSize < result.size()) { 259 | result.pollLast(); 260 | } 261 | min = result.last().score; 262 | } 263 | } 264 | result.pollFirst(); 265 | 266 | return result; 267 | } 268 | 269 | private float[] sum(float[] center, float[] fs) { 270 | // TODO Auto-generated method stub 271 | 272 | if (center == null && fs == null) { 273 | return null; 274 | } 275 | 276 | if (fs == null) { 277 | return center; 278 | } 279 | 280 | if (center == null) { 281 | return fs; 282 | } 283 | 284 | for (int i = 0; i < fs.length; i++) { 285 | center[i] += fs[i]; 286 | } 287 | 288 | return center; 289 | } 290 | 291 | /** 292 | * 得到词向量 293 | * 294 | * @param word 295 | * @return 296 | */ 297 | public float[] getWordVector(String word) { 298 | return wordMap.get(word); 299 | } 300 | 301 | public static float readFloat(InputStream is) throws IOException { 302 | byte[] bytes = new byte[4]; 303 | is.read(bytes); 304 | return getFloat(bytes); 305 | } 306 | 307 | /** 308 | * 读取一个float 309 | * 310 | * @param b 311 | * @return 312 | */ 313 | public static float getFloat(byte[] b) { 314 | int accum = 0; 315 | accum = accum | (b[0] & 0xff) << 0; 316 | accum = accum | (b[1] & 0xff) << 8; 317 | accum = accum | (b[2] & 0xff) << 16; 318 | accum = accum | (b[3] & 0xff) << 24; 319 | return Float.intBitsToFloat(accum); 320 | } 321 | 322 | /** 323 | * 读取一个字符串 324 | * 325 | * @param dis 326 | * @return 327 | * @throws IOException 328 | */ 329 | private static String readString(DataInputStream dis) throws IOException { 330 | // TODO Auto-generated method stub 331 | byte[] bytes = new byte[MAX_SIZE]; 332 | byte b = dis.readByte(); 333 | int i = -1; 334 | StringBuilder sb = new StringBuilder(); 335 | while (b != 32 && b != 10) { 336 | i++; 337 | bytes[i] = b; 338 | b = dis.readByte(); 339 | if (i == 49) { 340 | sb.append(new String(bytes)); 341 | i = -1; 342 | bytes = new byte[MAX_SIZE]; 343 | } 344 | } 345 | sb.append(new String(bytes, 0, i + 1)); 346 | return sb.toString(); 347 | } 348 | 349 | public int getTopNSize() { 350 | return topNSize; 351 | } 352 | 353 | public void setTopNSize(int topNSize) { 354 | this.topNSize = topNSize; 355 | } 356 | 357 | public HashMap getWordMap() { 358 | return wordMap; 359 | } 360 | 361 | public int getWords() { 362 | return words; 363 | } 364 | 365 | public int getSize() { 366 | return size; 367 | } 368 | 369 | } 370 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/WordPredict.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | /** 8 | * Created by sssd on 2017/7/18. 9 | */ 10 | public class WordPredict implements PredictModel { 11 | 12 | protected TextAnalysis textAnalysis = new TextAnalysis(); 13 | protected Set negSet; 14 | protected Set posSet; 15 | 16 | public void init(InputPath inputPath) throws Exception { 17 | String negWordPath = "C:\\Users\\sssd\\Desktop\\data\\NTUSD_negative_simplified.txt"; 18 | String posWOrdPath = "C:\\Users\\sssd\\Desktop\\data\\NTUSD_positive_simplified.txt"; 19 | // String negWordPath = inputPath.getNegPATH(); 20 | // String posWOrdPath = inputPath.getPosPath(); 21 | negSet = textAnalysis.readSet(negWordPath); 22 | posSet = textAnalysis.readSet(posWOrdPath); 23 | } 24 | 25 | public List predict(String sentence) throws Exception { 26 | String tetxSplits = TextAnalysis.getSplitWord(sentence); 27 | 28 | // 句子在负面词的相关性 29 | List psoLists = textAnalysis.textCompare(tetxSplits, posSet); 30 | 31 | // 句子在负面词的相关性 32 | List negLists = textAnalysis.textCompare(tetxSplits, negSet); 33 | 34 | List predictList = new ArrayList(); 35 | for(int i =0; i < negLists.size(); i++){ 36 | // predictList.add((Integer) negLists.get(i) - (Integer)psoLists.get(i)); 37 | if((Integer) negLists.get(i) > (Integer)psoLists.get(i)){ 38 | predictList.add(1); 39 | } else if((Integer) negLists.get(i) < (Integer)psoLists.get(i)){ 40 | predictList.add(-1); 41 | } else { 42 | predictList.add(0); 43 | } 44 | } 45 | return predictList; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/WordScordPredict2.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import com.google.common.io.Files; 4 | 5 | import java.io.File; 6 | import java.nio.charset.Charset; 7 | import java.util.*; 8 | 9 | /** 10 | * Created by sssd on 2017/7/20. 11 | */ 12 | public class WordScordPredict2 implements PredictModel { 13 | protected TextAnalysis textAnalysis = new TextAnalysis(); 14 | protected Map senDict; 15 | protected List notList; 16 | protected Map degreeDict; 17 | 18 | public void init(InputPath inputPath) throws Exception { 19 | 20 | String emtionPath = inputPath.getEmotionPath(); 21 | String denyPath = inputPath.getDenyPath(); 22 | String levelPath = inputPath.getLevelPath(); 23 | 24 | senDict = textAnalysis.readText2Map(emtionPath); 25 | notList = Files.readLines(new File(denyPath), Charset.forName("UTF-8")); //返回的是List数组 26 | degreeDict = textAnalysis.readText2Map(levelPath); 27 | 28 | } 29 | 30 | public List predict(String text) throws Exception { 31 | 32 | List preLab = new ArrayList(); 33 | Double sum = 0.0; 34 | String[] sentences = text.split("。"); 35 | for (String sentence: sentences){ 36 | System.out.println(sentence); 37 | Map senWord = new LinkedHashMap(); 38 | Map notWord = new LinkedHashMap(); 39 | Map degreeWord = new LinkedHashMap(); 40 | String[] splitSentence = TextAnalysis.getSplitWord(sentence).split(" "); 41 | 42 | //将句子中的各类分词分别存储并记录其位置 43 | for(int i = 0; i degreeDict; 21 | protected String regEx=":|。|!|;|,|(|)"; 22 | 23 | public void init(InputPath inputPath) throws Exception { 24 | 25 | String posPath = inputPath.getPosPath(); 26 | String negPath = inputPath.getNegPATH(); 27 | String stopPath = inputPath.getStopWordPath(); 28 | String degreePath = inputPath.getLevelPath(); 29 | posList = Files.readLines(new File(posPath), Charset.forName("UTF-8")); 30 | negList = Files.readLines(new File(negPath), Charset.forName("UTF-8")); 31 | stopWordList = Files.readLines(new File(stopPath), Charset.forName("UTF-8")); 32 | degreeDict = textAnalysis.readText2Map(degreePath); 33 | System.out.println("初始化完成!"); 34 | } 35 | 36 | public List predict(String text) throws Exception { 37 | Pattern p = Pattern.compile(regEx); 38 | String[] sentences = p.split(text); 39 | List prelist = new ArrayList(); 40 | double poscounts = 0.0; 41 | double negcounts = 0.0; 42 | //对单个语句进行分析 43 | for(int i=0; i=0; k-- ){ 69 | if(posList.contains(splitWords[k])){ 70 | poscount += 2; 71 | break; 72 | }else if(negList.contains(splitWords[k])){ 73 | negcount +=2; 74 | break; 75 | } 76 | } 77 | } 78 | } 79 | poscounts = poscounts + poscount; 80 | negcounts = negcounts + negcount ; 81 | } 82 | prelist.add(poscounts-negcounts); 83 | return prelist; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/WordScorePredict.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * Created by sssd on 2017/7/19. 10 | */ 11 | public class WordScorePredict implements PredictModel { 12 | 13 | protected TextAnalysis textAnalysis = new TextAnalysis(); 14 | protected Map textMap = new HashMap(); 15 | 16 | //读入路径返回词典中的数据 17 | public void init(InputPath inputPath) throws Exception { 18 | // String path = "C:\\Users\\sssd\\Desktop\\data\\BosonNLP_sentiment_score.txt"; 19 | String path = inputPath.getPath(); 20 | textMap = textAnalysis.readText2Map(path); 21 | } 22 | 23 | public List predict(String sentence) throws Exception { 24 | List preLsit = new ArrayList(); 25 | String[] textSplits = TextAnalysis.getSplitWord(sentence).split(" "); 26 | Double sentenceWeight = textAnalysis.wordScoreCompare(textSplits,textMap); 27 | preLsit.add(sentenceWeight); 28 | return preLsit; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/domain/HiddenNeuron.java: -------------------------------------------------------------------------------- 1 | package textanalysis.domain; 2 | 3 | public class HiddenNeuron extends Neuron{ 4 | 5 | public double[] syn1 ; //hidden->out 6 | 7 | public HiddenNeuron(int layerSize){ 8 | syn1 = new double[layerSize] ; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/domain/Neuron.java: -------------------------------------------------------------------------------- 1 | package textanalysis.domain; 2 | 3 | public abstract class Neuron implements Comparable { 4 | public double freq; 5 | public Neuron parent; 6 | public int code; 7 | // 语料预分类 8 | public int category = -1; 9 | 10 | 11 | public int compareTo(Neuron neuron) { 12 | if (this.category == neuron.category) { 13 | if (this.freq > neuron.freq) { 14 | return 1; 15 | } else { 16 | return -1; 17 | } 18 | } else if (this.category > neuron.category) { 19 | return 1; 20 | } else { 21 | return -1; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/domain/WordEntry.java: -------------------------------------------------------------------------------- 1 | package textanalysis.domain; 2 | 3 | 4 | public class WordEntry implements Comparable { 5 | public String name; 6 | public float score; 7 | 8 | public WordEntry(String name, float score) { 9 | this.name = name; 10 | this.score = score; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | // TODO Auto-generated method stub 16 | return this.name + "\t" + score; 17 | } 18 | 19 | 20 | public int compareTo(WordEntry o) { 21 | // TODO Auto-generated method stub 22 | if (this.score < o.score) { 23 | return 1; 24 | } else { 25 | return -1; 26 | } 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/main/java/textanalysis/domain/WordNeuron.java: -------------------------------------------------------------------------------- 1 | package textanalysis.domain; 2 | 3 | import java.util.Collections; 4 | import java.util.LinkedList; 5 | import java.util.List; 6 | import java.util.Random; 7 | 8 | public class WordNeuron extends Neuron { 9 | public String name; 10 | public double[] syn0 = null; // input->hidden 11 | public List neurons = null;// 路径神经元 12 | public int[] codeArr = null; 13 | 14 | public List makeNeurons() { 15 | if (neurons != null) { 16 | return neurons; 17 | } 18 | Neuron neuron = this; 19 | neurons = new LinkedList(); 20 | while ((neuron = neuron.parent) != null) { 21 | neurons.add(neuron); 22 | } 23 | Collections.reverse(neurons); 24 | codeArr = new int[neurons.size()]; 25 | 26 | for (int i = 1; i < neurons.size(); i++) { 27 | codeArr[i - 1] = neurons.get(i).code; 28 | } 29 | codeArr[codeArr.length - 1] = this.code; 30 | 31 | return neurons; 32 | } 33 | 34 | public WordNeuron(String name, double freq, int layerSize) { 35 | this.name = name; 36 | this.freq = freq; 37 | this.syn0 = new double[layerSize]; 38 | Random random = new Random(); 39 | for (int i = 0; i < syn0.length; i++) { 40 | syn0[i] = (random.nextDouble() - 0.5) / layerSize; 41 | } 42 | } 43 | 44 | /** 45 | * 用于有监督的创造hoffman tree 46 | * 47 | * @param name 48 | * @param freq 49 | * @param layerSize 50 | */ 51 | public WordNeuron(String name, double freq, int category, int layerSize) { 52 | this.name = name; 53 | this.freq = freq; 54 | this.syn0 = new double[layerSize]; 55 | this.category = category; 56 | Random random = new Random(); 57 | for (int i = 0; i < syn0.length; i++) { 58 | syn0[i] = (random.nextDouble() - 0.5) / layerSize; 59 | } 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /src/main/java/textanalysis/svm_predict.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import libsvm.*; 4 | 5 | import java.io.*; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.StringTokenizer; 9 | 10 | class svm_predict { 11 | private static svm_print_interface svm_print_null = new svm_print_interface() 12 | { 13 | public void print(String s) {} 14 | }; 15 | 16 | private static svm_print_interface svm_print_stdout = new svm_print_interface() 17 | { 18 | public void print(String s) 19 | { 20 | System.out.print(s); 21 | } 22 | }; 23 | 24 | private static svm_print_interface svm_print_string = svm_print_stdout; 25 | 26 | static void info(String s) 27 | { 28 | svm_print_string.print(s); 29 | } 30 | 31 | private static double atof(String s) 32 | { 33 | return Double.valueOf(s).doubleValue(); 34 | } 35 | 36 | private static int atoi(String s) 37 | { 38 | return Integer.parseInt(s); 39 | } 40 | 41 | private static List predict(BufferedReader input, DataOutputStream output, svm_model model, int predict_probability) throws IOException 42 | { 43 | int correct = 0; 44 | int total = 0; 45 | double error = 0; 46 | double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0; 47 | List predictLabel = new ArrayList(); 48 | 49 | int svm_type=svm.svm_get_svm_type(model); 50 | int nr_class=svm.svm_get_nr_class(model); 51 | double[] prob_estimates=null; 52 | 53 | if(predict_probability == 1) 54 | { 55 | if(svm_type == svm_parameter.EPSILON_SVR || 56 | svm_type == svm_parameter.NU_SVR) 57 | { 58 | svm_predict.info("Prob. model for test data: target value = predicted value + z,\nz: Laplace distribution e^(-|z|/sigma)/(2sigma),sigma="+svm.svm_get_svr_probability(model)+"\n"); 59 | } 60 | else 61 | { 62 | int[] labels=new int[nr_class]; 63 | svm.svm_get_labels(model,labels); 64 | prob_estimates = new double[nr_class]; 65 | output.writeBytes("labels"); 66 | for(int j=0;j=argv.length-2) 164 | exit_with_help(); 165 | try 166 | { 167 | BufferedReader input = new BufferedReader(new FileReader(argv[i])); 168 | DataOutputStream output = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(argv[i+2]))); 169 | svm_model model = svm.svm_load_model(argv[i+1]); 170 | if(predict_probability == 1) 171 | { 172 | if(svm.svm_check_probability_model(model)==0) 173 | { 174 | System.err.print("Model does not support probabiliy estimates\n"); 175 | System.exit(1); 176 | } 177 | } 178 | else 179 | { 180 | if(svm.svm_check_probability_model(model)!=0) 181 | { 182 | svm_predict.info("Model supports probability estimates, but disabled in prediction.\n"); 183 | } 184 | } 185 | List predict = predict(input,output,model,predict_probability); 186 | predictLabel.add(predict.get(0)); 187 | input.close(); 188 | output.close(); 189 | } 190 | catch(FileNotFoundException e) 191 | { 192 | exit_with_help(); 193 | } 194 | catch(ArrayIndexOutOfBoundsException e) 195 | { 196 | exit_with_help(); 197 | } 198 | return predictLabel; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/svm_scale.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import java.io.*; 4 | import java.util.Formatter; 5 | import java.util.StringTokenizer; 6 | 7 | class svm_scale 8 | { 9 | private String line = null; 10 | private double lower = -1.0; 11 | private double upper = 1.0; 12 | private double y_lower; 13 | private double y_upper; 14 | private boolean y_scaling = false; 15 | private double[] feature_max; 16 | private double[] feature_min; 17 | private double y_max = -Double.MAX_VALUE; 18 | private double y_min = Double.MAX_VALUE; 19 | private int max_index; 20 | private long num_nonzeros = 0; 21 | private long new_num_nonzeros = 0; 22 | 23 | private static void exit_with_help() 24 | { 25 | System.out.print( 26 | "Usage: svm-scale [options] data_filename\n" 27 | +"options:\n" 28 | +"-l lower : x scaling lower limit (default -1)\n" 29 | +"-u upper : x scaling upper limit (default +1)\n" 30 | +"-y y_lower y_upper : y scaling limits (default: no y scaling)\n" 31 | +"-s save_filename : save scaling parameters to save_filename\n" 32 | +"-r restore_filename : restore scaling parameters from restore_filename\n" 33 | ); 34 | System.exit(1); 35 | } 36 | 37 | private BufferedReader rewind(BufferedReader fp, String filename) throws IOException 38 | { 39 | fp.close(); 40 | return new BufferedReader(new FileReader(filename)); 41 | } 42 | 43 | private void output_target(double value) 44 | { 45 | if(y_scaling) 46 | { 47 | if(value == y_min) 48 | value = y_lower; 49 | else if(value == y_max) 50 | value = y_upper; 51 | else 52 | value = y_lower + (y_upper-y_lower) * 53 | (value-y_min) / (y_max-y_min); 54 | } 55 | 56 | System.out.print(value + " "); 57 | } 58 | 59 | private void output(int index, double value) 60 | { 61 | /* skip single-valued attribute */ 62 | if(feature_max[index] == feature_min[index]) 63 | return; 64 | 65 | if(value == feature_min[index]) 66 | value = lower; 67 | else if(value == feature_max[index]) 68 | value = upper; 69 | else 70 | value = lower + (upper-lower) * 71 | (value-feature_min[index])/ 72 | (feature_max[index]-feature_min[index]); 73 | 74 | if(value != 0) 75 | { 76 | System.out.print(index + ":" + value + " "); 77 | new_num_nonzeros++; 78 | } 79 | } 80 | 81 | private String readline(BufferedReader fp) throws IOException 82 | { 83 | line = fp.readLine(); 84 | return line; 85 | } 86 | 87 | private void run(String []argv) throws IOException 88 | { 89 | int i,index; 90 | BufferedReader fp = null, fp_restore = null; 91 | String save_filename = null; 92 | String restore_filename = null; 93 | String data_filename = null; 94 | 95 | 96 | for(i=0;i lower) || (y_scaling && !(y_upper > y_lower))) 119 | { 120 | System.err.println("inconsistent lower/upper specification"); 121 | System.exit(1); 122 | } 123 | if(restore_filename != null && save_filename != null) 124 | { 125 | System.err.println("cannot use -r and -s simultaneously"); 126 | System.exit(1); 127 | } 128 | 129 | if(argv.length != i+1) 130 | exit_with_help(); 131 | 132 | data_filename = argv[i]; 133 | try { 134 | fp = new BufferedReader(new FileReader(data_filename)); 135 | } catch (Exception e) { 136 | System.err.println("can't open file " + data_filename); 137 | System.exit(1); 138 | } 139 | 140 | /* assumption: min index of attributes is 1 */ 141 | /* pass 1: find out max index of attributes */ 142 | max_index = 0; 143 | 144 | if(restore_filename != null) 145 | { 146 | int idx, c; 147 | 148 | try { 149 | fp_restore = new BufferedReader(new FileReader(restore_filename)); 150 | } 151 | catch (Exception e) { 152 | System.err.println("can't open file " + restore_filename); 153 | System.exit(1); 154 | } 155 | if((c = fp_restore.read()) == 'y') 156 | { 157 | fp_restore.readLine(); 158 | fp_restore.readLine(); 159 | fp_restore.readLine(); 160 | } 161 | fp_restore.readLine(); 162 | fp_restore.readLine(); 163 | 164 | String restore_line = null; 165 | while((restore_line = fp_restore.readLine())!=null) 166 | { 167 | StringTokenizer st2 = new StringTokenizer(restore_line); 168 | idx = Integer.parseInt(st2.nextToken()); 169 | max_index = Math.max(max_index, idx); 170 | } 171 | fp_restore = rewind(fp_restore, restore_filename); 172 | } 173 | 174 | while (readline(fp) != null) 175 | { 176 | StringTokenizer st = new StringTokenizer(line," \t\n\r\f:"); 177 | st.nextToken(); 178 | while(st.hasMoreTokens()) 179 | { 180 | index = Integer.parseInt(st.nextToken()); 181 | max_index = Math.max(max_index, index); 182 | st.nextToken(); 183 | num_nonzeros++; 184 | } 185 | } 186 | 187 | try { 188 | feature_max = new double[(max_index+1)]; 189 | feature_min = new double[(max_index+1)]; 190 | } catch(OutOfMemoryError e) { 191 | System.err.println("can't allocate enough memory"); 192 | System.exit(1); 193 | } 194 | 195 | for(i=0;i<=max_index;i++) 196 | { 197 | feature_max[i] = -Double.MAX_VALUE; 198 | feature_min[i] = Double.MAX_VALUE; 199 | } 200 | 201 | fp = rewind(fp, data_filename); 202 | 203 | /* pass 2: find out min/max value */ 204 | while(readline(fp) != null) 205 | { 206 | int next_index = 1; 207 | double target; 208 | double value; 209 | 210 | StringTokenizer st = new StringTokenizer(line," \t\n\r\f:"); 211 | target = Double.parseDouble(st.nextToken()); 212 | y_max = Math.max(y_max, target); 213 | y_min = Math.min(y_min, target); 214 | 215 | while (st.hasMoreTokens()) 216 | { 217 | index = Integer.parseInt(st.nextToken()); 218 | value = Double.parseDouble(st.nextToken()); 219 | 220 | for (i = next_index; i num_nonzeros) 338 | System.err.print( 339 | "WARNING: original #nonzeros " + num_nonzeros+"\n" 340 | +" new #nonzeros " + new_num_nonzeros+"\n" 341 | +"Use -l 0 if many original feature values are zeros\n"); 342 | 343 | fp.close(); 344 | } 345 | 346 | public static void main(String argv[]) throws IOException 347 | { 348 | svm_scale s = new svm_scale(); 349 | s.run(argv); 350 | } 351 | } 352 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/svm_train.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import libsvm.*; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.FileReader; 7 | import java.io.IOException; 8 | import java.util.StringTokenizer; 9 | import java.util.Vector; 10 | 11 | class svm_train { 12 | private svm_parameter param; // set by parse_command_line 13 | private svm_problem prob; // set by read_problem 14 | private svm_model model; 15 | private String input_file_name; // set by parse_command_line 16 | private String model_file_name; // set by parse_command_line 17 | private String error_msg; 18 | private int cross_validation; 19 | private int nr_fold; 20 | 21 | private static svm_print_interface svm_print_null = new svm_print_interface() 22 | { 23 | public void print(String s) {} 24 | }; 25 | 26 | private static void exit_with_help() 27 | { 28 | System.out.print( 29 | "Usage: svm_train [options] training_set_file [model_file]\n" 30 | +"options:\n" 31 | +"-s svm_type : set type of SVM (default 0)\n" 32 | +" 0 -- C-SVC (multi-class classification)\n" 33 | +" 1 -- nu-SVC (multi-class classification)\n" 34 | +" 2 -- one-class SVM\n" 35 | +" 3 -- epsilon-SVR (regression)\n" 36 | +" 4 -- nu-SVR (regression)\n" 37 | +"-t kernel_type : set type of kernel function (default 2)\n" 38 | +" 0 -- linear: u'*v\n" 39 | +" 1 -- polynomial: (gamma*u'*v + coef0)^degree\n" 40 | +" 2 -- radial basis function: exp(-gamma*|u-v|^2)\n" 41 | +" 3 -- sigmoid: tanh(gamma*u'*v + coef0)\n" 42 | +" 4 -- precomputed kernel (kernel values in training_set_file)\n" 43 | +"-d degree : set degree in kernel function (default 3)\n" 44 | +"-g gamma : set gamma in kernel function (default 1/num_features)\n" 45 | +"-r coef0 : set coef0 in kernel function (default 0)\n" 46 | +"-c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1)\n" 47 | +"-n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)\n" 48 | +"-p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)\n" 49 | +"-m cachesize : set cache memory size in MB (default 100)\n" 50 | +"-e epsilon : set tolerance of termination criterion (default 0.001)\n" 51 | +"-h shrinking : whether to use the shrinking heuristics, 0 or 1 (default 1)\n" 52 | +"-b probability_estimates : whether to train a SVC or SVR model for probability estimates, 0 or 1 (default 0)\n" 53 | +"-wi weight : set the parameter C of class i to weight*C, for C-SVC (default 1)\n" 54 | +"-v n : n-fold cross validation mode\n" 55 | +"-q : quiet mode (no outputs)\n" 56 | ); 57 | System.exit(1); 58 | } 59 | 60 | private void do_cross_validation() 61 | { 62 | int i; 63 | int total_correct = 0; 64 | double total_error = 0; 65 | double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0; 66 | double[] target = new double[prob.l]; 67 | 68 | svm.svm_cross_validation(prob,param,nr_fold,target); 69 | if(param.svm_type == svm_parameter.EPSILON_SVR || 70 | param.svm_type == svm_parameter.NU_SVR) 71 | { 72 | for(i=0;i=argv.length) 172 | exit_with_help(); 173 | switch(argv[i-1].charAt(1)) 174 | { 175 | case 's': 176 | param.svm_type = atoi(argv[i]); 177 | break; 178 | case 't': 179 | param.kernel_type = atoi(argv[i]); 180 | break; 181 | case 'd': 182 | param.degree = atoi(argv[i]); 183 | break; 184 | case 'g': 185 | param.gamma = atof(argv[i]); 186 | break; 187 | case 'r': 188 | param.coef0 = atof(argv[i]); 189 | break; 190 | case 'n': 191 | param.nu = atof(argv[i]); 192 | break; 193 | case 'm': 194 | param.cache_size = atof(argv[i]); 195 | break; 196 | case 'c': 197 | param.C = atof(argv[i]); 198 | break; 199 | case 'e': 200 | param.eps = atof(argv[i]); 201 | break; 202 | case 'p': 203 | param.p = atof(argv[i]); 204 | break; 205 | case 'h': 206 | param.shrinking = atoi(argv[i]); 207 | break; 208 | case 'b': 209 | param.probability = atoi(argv[i]); 210 | break; 211 | case 'q': 212 | print_func = svm_print_null; 213 | i--; 214 | break; 215 | case 'v': 216 | cross_validation = 1; 217 | nr_fold = atoi(argv[i]); 218 | if(nr_fold < 2) 219 | { 220 | System.err.print("n-fold cross validation: n must >= 2\n"); 221 | exit_with_help(); 222 | } 223 | break; 224 | case 'w': 225 | ++param.nr_weight; 226 | { 227 | int[] old = param.weight_label; 228 | param.weight_label = new int[param.nr_weight]; 229 | System.arraycopy(old,0,param.weight_label,0,param.nr_weight-1); 230 | } 231 | 232 | { 233 | double[] old = param.weight; 234 | param.weight = new double[param.nr_weight]; 235 | System.arraycopy(old,0,param.weight,0,param.nr_weight-1); 236 | } 237 | 238 | param.weight_label[param.nr_weight-1] = atoi(argv[i-1].substring(2)); 239 | param.weight[param.nr_weight-1] = atof(argv[i]); 240 | break; 241 | default: 242 | System.err.print("Unknown option: " + argv[i-1] + "\n"); 243 | exit_with_help(); 244 | } 245 | } 246 | 247 | svm.svm_set_print_string_function(print_func); 248 | 249 | // determine filenames 250 | 251 | if(i>=argv.length) 252 | exit_with_help(); 253 | 254 | input_file_name = argv[i]; 255 | 256 | if(i vy = new Vector(); 272 | Vector vx = new Vector(); 273 | int max_index = 0; 274 | 275 | while(true) 276 | { 277 | String line = fp.readLine(); 278 | if(line == null) break; 279 | 280 | StringTokenizer st = new StringTokenizer(line," \t\n\r\f:"); 281 | 282 | vy.addElement(atof(st.nextToken())); 283 | int m = st.countTokens()/2; 284 | svm_node[] x = new svm_node[m]; 285 | for(int j=0;j0) max_index = Math.max(max_index, x[m-1].index); 292 | vx.addElement(x); 293 | } 294 | 295 | prob = new svm_problem(); 296 | prob.l = vy.size(); 297 | prob.x = new svm_node[prob.l][]; 298 | for(int i=0;i 0) 305 | param.gamma = 1.0/max_index; 306 | 307 | if(param.kernel_type == svm_parameter.PRECOMPUTED) 308 | for(int i=0;i max_index) 316 | { 317 | System.err.print("Wrong input format: sample_serial_number out of range\n"); 318 | System.exit(1); 319 | } 320 | } 321 | 322 | fp.close(); 323 | } 324 | } 325 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/util/Haffman.java: -------------------------------------------------------------------------------- 1 | package textanalysis.util; 2 | 3 | import textanalysis.domain.HiddenNeuron; 4 | import textanalysis.domain.Neuron; 5 | 6 | import java.util.Collection; 7 | import java.util.TreeSet; 8 | 9 | 10 | /** 11 | * 构建Haffman编码树 12 | * 13 | * @author ansj 14 | * 15 | */ 16 | public class Haffman { 17 | private int layerSize; 18 | 19 | public Haffman(int layerSize) { 20 | this.layerSize = layerSize; 21 | } 22 | 23 | private TreeSet set = new TreeSet(); 24 | 25 | public void make(Collection neurons) { 26 | set.addAll(neurons); 27 | while (set.size() > 1) { 28 | merger(); 29 | } 30 | } 31 | 32 | private void merger() { 33 | HiddenNeuron hn = new HiddenNeuron(layerSize); 34 | Neuron min1 = set.pollFirst(); 35 | Neuron min2 = set.pollFirst(); 36 | hn.category = min2.category; 37 | hn.freq = min1.freq + min2.freq; 38 | min1.parent = hn; 39 | min2.parent = hn; 40 | min1.code = 0; 41 | min2.code = 1; 42 | set.add(hn); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/util/MapCount.java: -------------------------------------------------------------------------------- 1 | // 2 | // Source code recreated from a .class file by IntelliJ IDEA 3 | // (powered by Fernflower decompiler) 4 | // 5 | 6 | package textanalysis.util; 7 | 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Map.Entry; 11 | 12 | public class MapCount { 13 | private HashMap hm = null; 14 | 15 | public MapCount() { 16 | this.hm = new HashMap(); 17 | } 18 | 19 | public MapCount(int initialCapacity) { 20 | this.hm = new HashMap(initialCapacity); 21 | } 22 | 23 | public void add(T t, int n) { 24 | Integer integer = null; 25 | if((integer = (Integer)this.hm.get(t)) != null) { 26 | this.hm.put(t, Integer.valueOf(integer.intValue() + n)); 27 | } else { 28 | this.hm.put(t, Integer.valueOf(n)); 29 | } 30 | 31 | } 32 | 33 | public void add(T t) { 34 | this.add(t, 1); 35 | } 36 | 37 | public int size() { 38 | return this.hm.size(); 39 | } 40 | 41 | public void remove(T t) { 42 | this.hm.remove(t); 43 | } 44 | 45 | public HashMap get() { 46 | return this.hm; 47 | } 48 | 49 | public String getDic() { 50 | Iterator iterator = this.hm.entrySet().iterator(); 51 | StringBuilder sb = new StringBuilder(); 52 | Entry next = null; 53 | 54 | while(iterator.hasNext()) { 55 | next = (Entry)iterator.next(); 56 | sb.append(next.getKey()); 57 | sb.append("\t"); 58 | sb.append(next.getValue()); 59 | sb.append("\n"); 60 | } 61 | 62 | return sb.toString(); 63 | } 64 | 65 | public static void main(String[] args) { 66 | System.out.println(9223372036854775807L); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/textanalysis/util/WordKmeans.java: -------------------------------------------------------------------------------- 1 | package textanalysis.util; 2 | 3 | 4 | import textanalysis.Word2VEC; 5 | 6 | import java.io.IOException; 7 | import java.util.*; 8 | 9 | 10 | /** 11 | * Created by hui on 2017/7/16. 12 | */ 13 | public class WordKmeans { 14 | 15 | public static void main(String[] args) throws IOException { 16 | Word2VEC vec = new Word2VEC(); 17 | vec.loadGoogleModel("vectors.bin"); 18 | System.out.println("load model ok!"); 19 | WordKmeans wordKmeans = new WordKmeans(vec.getWordMap(), 50, 50); 20 | Classes[] explain = wordKmeans.explain(); 21 | 22 | for (int i = 0; i < explain.length; i++) { 23 | System.out.println("--------" + i + "---------"); 24 | System.out.println(explain[i].getTop(10)); 25 | } 26 | 27 | } 28 | 29 | private HashMap wordMap = null; 30 | 31 | private int iter; 32 | 33 | private Classes[] cArray = null; 34 | 35 | public WordKmeans(HashMap wordMap, int clcn, int iter) { 36 | this.wordMap = wordMap; 37 | this.iter = iter; 38 | cArray = new Classes[clcn]; 39 | } 40 | 41 | public Classes[] explain() { 42 | //first 取前clcn个点 43 | Iterator> iterator = wordMap.entrySet().iterator(); 44 | for (int i = 0; i < cArray.length; i++) { 45 | Map.Entry next = iterator.next(); 46 | cArray[i] = new Classes(i, next.getValue()); 47 | } 48 | 49 | for (int i = 0; i < iter; i++) { 50 | for (Classes classes : cArray) { 51 | classes.clean(); 52 | } 53 | 54 | iterator = wordMap.entrySet().iterator(); 55 | while (iterator.hasNext()) { 56 | Map.Entry next = iterator.next(); 57 | double miniScore = Double.MAX_VALUE; 58 | double tempScore; 59 | int classesId = 0; 60 | for (Classes classes : cArray) { 61 | tempScore = classes.distance(next.getValue()); 62 | if (miniScore > tempScore) { 63 | miniScore = tempScore; 64 | classesId = classes.id; 65 | } 66 | } 67 | cArray[classesId].putValue(next.getKey(), miniScore); 68 | } 69 | 70 | for (Classes classes : cArray) { 71 | classes.updateCenter(wordMap); 72 | } 73 | System.out.println("iter " + i + " ok!"); 74 | } 75 | 76 | return cArray; 77 | } 78 | 79 | public static class Classes { 80 | private int id; 81 | 82 | private float[] center; 83 | 84 | public Classes(int id, float[] center) { 85 | this.id = id; 86 | this.center = center.clone(); 87 | } 88 | 89 | Map values = new HashMap(); 90 | 91 | public double distance(float[] value) { 92 | double sum = 0; 93 | for (int i = 0; i < value.length; i++) { 94 | sum += (center[i] - value[i])*(center[i] - value[i]) ; 95 | } 96 | return sum ; 97 | } 98 | 99 | public void putValue(String word, double score) { 100 | values.put(word, score); 101 | } 102 | 103 | /** 104 | * 重新计算中心点 105 | * @param wordMap 106 | */ 107 | public void updateCenter(HashMap wordMap) { 108 | for (int i = 0; i < center.length; i++) { 109 | center[i] = 0; 110 | } 111 | float[] value = null; 112 | for (String keyWord : values.keySet()) { 113 | value = wordMap.get(keyWord); 114 | for (int i = 0; i < value.length; i++) { 115 | center[i] += value[i]; 116 | } 117 | } 118 | for (int i = 0; i < center.length; i++) { 119 | center[i] = center[i] / values.size(); 120 | } 121 | } 122 | 123 | /** 124 | * 清空历史结果 125 | */ 126 | public void clean() { 127 | // TODO Auto-generated method stub 128 | values.clear(); 129 | } 130 | 131 | /** 132 | * 取得每个类别的前n个结果 133 | * @param n 134 | * @return 135 | */ 136 | public List> getTop(int n) { 137 | List> arrayList = new ArrayList>( 138 | values.entrySet()); 139 | Collections.sort(arrayList, new Comparator>() { 140 | 141 | public int compare(Map.Entry o1, Map.Entry o2) { 142 | // TODO Auto-generated method stub 143 | return o1.getValue() > o2.getValue() ? 1 : -1; 144 | } 145 | }); 146 | int min = Math.min(n, arrayList.size() - 1); 147 | if(min<=1)return Collections.emptyList() ; 148 | return arrayList.subList(0, min); 149 | } 150 | 151 | } 152 | 153 | } 154 | -------------------------------------------------------------------------------- /src/main/resources/stop_words.ml: -------------------------------------------------------------------------------- 1 | stopwords 2 | 的 3 | 第二 4 | 一番 5 | 一直 6 | 一个 7 | 有的是 8 | 也就是说 9 | 哎哟 10 | 俺们 11 | 按照 12 | 吧哒 13 | 本着 14 | 比方 15 | 比如 16 | 鄙人 17 | 彼此 18 | 别的 19 | 别说 20 | 并且 21 | 不比 22 | 不单 23 | 不但 24 | 不独 25 | 不光 26 | 不仅 27 | 不拘 28 | 不论 29 | 不然 30 | 不如 31 | 不特 32 | 不惟 33 | 不问 34 | 不只 35 | 朝着 36 | 趁着 37 | 除此之外 38 | 除非 39 | 除了 40 | 此间 41 | 此外 42 | 从而 43 | 但是 44 | 当着 45 | 的话 46 | 等等 47 | 叮咚 48 | 对于 49 | 多少 50 | 而况 51 | 而且 52 | 而是 53 | 而外 54 | 而言 55 | 而已 56 | 尔后 57 | 反过来 58 | 反过来说 59 | 反之 60 | 非但 61 | 非徒 62 | 否则 63 | 嘎登 64 | 各个 65 | 各位 66 | 各种 67 | 各自 68 | 根据 69 | 故此 70 | 固然 71 | 关于 72 | 果然 73 | 果真 74 | 何处 75 | 何况 76 | 何时 77 | 哼唷 78 | 呼哧 79 | 还是 80 | 还有 81 | 换句话说 82 | 换言之 83 | 或是 84 | 或者 85 | 极了 86 | 及其 87 | 及至 88 | 即便 89 | 即或 90 | 即令 91 | 即若 92 | 即使 93 | 几时 94 | 既然 95 | 既是 96 | 继而 97 | 加之 98 | 假如 99 | 假若 100 | 假使 101 | 鉴于 102 | 较之 103 | 接着 104 | 结果 105 | 紧接着 106 | 进而 107 | 尽管 108 | 经过 109 | 就是 110 | 就是说 111 | 具体地说 112 | 具体说来 113 | 开始 114 | 可见 115 | 可是 116 | 可以 117 | 况且 118 | 来着 119 | 例如 120 | 连同 121 | 两者 122 | 另外 123 | 另一方面 124 | 慢说 125 | 漫说 126 | 每当 127 | 莫若 128 | 某个 129 | 某些 130 | 哪边 131 | 哪儿 132 | 哪个 133 | 哪里 134 | 哪年 135 | 哪怕 136 | 哪天 137 | 哪些 138 | 哪样 139 | 那边 140 | 那儿 141 | 那个 142 | 那会儿 143 | 那里 144 | 那么些 145 | 那么样 146 | 那时 147 | 那些 148 | 乃至 149 | 你们 150 | 宁肯 151 | 哦 152 | 呕 153 | 啪达 154 | 旁人 155 | 凭借 156 | 其次 157 | 其二 158 | 其他 159 | 其它 160 | 其一 161 | 其余 162 | 其中 163 | 起见 164 | 起见 165 | 岂但 166 | 恰恰相反 167 | 前后 168 | 前者 169 | 然而 170 | 然后 171 | 然则 172 | 人家 173 | 任何 174 | 任凭 175 | 如此 176 | 如果 177 | 如何 178 | 如其 179 | 如若 180 | 如上所述 181 | 若非 182 | 若是 183 | 上下 184 | 尚且 185 | 设若 186 | 设使 187 | 甚而 188 | 甚么 189 | 甚至 190 | 省得 191 | 时候 192 | 什么 193 | 什么样 194 | 使得 195 | 首先 196 | 谁知 197 | 顺着 198 | 似的 199 | 虽然 200 | 虽说 201 | 虽则 202 | 随着 203 | 所以 204 | 他们 205 | 他人 206 | 它们 207 | 她们 208 | 倘或 209 | 倘然 210 | 倘若 211 | 倘使 212 | 同时 213 | 万一 214 | 为何 215 | 为了 216 | 为什么 217 | 为着 218 | 嗡嗡 219 | 我们 220 | 呜呼 221 | 乌乎 222 | 无论 223 | 无宁 224 | 毋宁 225 | 相对而言 226 | 向着 227 | 嘘 228 | 呀 229 | 焉 230 | 沿 231 | 沿着 232 | 要不 233 | 要不然 234 | 要不是 235 | 要么 236 | 要是 237 | 也 238 | 也罢 239 | 也好 240 | 一般 241 | 一旦 242 | 一方面 243 | 一来 244 | 一切 245 | 一样 246 | 一则 247 | 依 248 | 依照 249 | 矣 250 | 以 251 | 以便 252 | 以及 253 | 以免 254 | 以至 255 | 以至于 256 | 以致 257 | 抑或 258 | 因 259 | 因此 260 | 因而 261 | 因为 262 | 哟 263 | 用 264 | 由 265 | 由此可见 266 | 由于 267 | 有 268 | 有的 269 | 有关 270 | 又 271 | 于 272 | 于是 273 | 于是乎 274 | 与 275 | 与此同时 276 | 与否 277 | 与其 278 | 云云 279 | 哉 280 | 再说 281 | 再者 282 | 在 283 | 在下 284 | 咱 285 | 咱们 286 | 则 287 | 怎 288 | 怎么 289 | 怎么办 290 | 怎么样 291 | 咋 292 | 照 293 | 照着 294 | 者 295 | 这 296 | 这边 297 | 这儿 298 | 这个 299 | 这会儿 300 | 这就是说 301 | 这里 302 | 这么 303 | 这么点儿 304 | 这么些 305 | 这么样 306 | 这时 307 | 这些 308 | 正如 309 | 吱 310 | 之 311 | 之类 312 | 之所以 313 | 之一 314 | 只是 315 | 只限 316 | 只要 317 | 只有 318 | 至于 319 | 着呢 320 | 自从 321 | 自个儿 322 | 自各儿 323 | 自己 324 | 自家 325 | 自身 326 | 综上所述 327 | 总的来看 328 | 总的来说 329 | 总的说来 330 | 总而言之 331 | 总之 332 | 纵 333 | 纵令 334 | 纵然 335 | 纵使 336 | 遵照 337 | 作为 338 | 兮 339 | 呃 340 | 呗 341 | 咚 342 | 咦 343 | 喏 344 | 啐 345 | 喔唷 346 | 嗬 347 | 嗯 348 | 嗳 -------------------------------------------------------------------------------- /src/main/resources/vector.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheng-rh/TextAnalysis/f8b875e999f0da0335873150114dd67e2efb3340/src/main/resources/vector.mod -------------------------------------------------------------------------------- /src/main/resources/中文停用词库2.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheng-rh/TextAnalysis/f8b875e999f0da0335873150114dd67e2efb3340/src/main/resources/中文停用词库2.ml -------------------------------------------------------------------------------- /src/test/java/textanalysis/SentencePredcitTest.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import com.google.common.io.Files; 4 | import com.google.common.math.DoubleMath; 5 | import org.junit.Test; 6 | 7 | import java.io.File; 8 | import java.nio.charset.Charset; 9 | import java.util.List; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Created by sssd on 2017/7/18. 15 | */ 16 | public class SentencePredcitTest { 17 | 18 | @Test 19 | public void outPrint()throws Exception{ 20 | 21 | SentencePredcit sentencePredcit = new SentencePredcit(); 22 | InputPath inputPath = new InputPath(); 23 | 24 | /* //1,采用的是机器学习 25 | int method = 1; 26 | String negPath = "C:\\Users\\sssd\\Desktop\\data\\train\\negdata.txt"; 27 | String posPath = "C:\\Users\\sssd\\Desktop\\data\\train\\posdata.txt"; 28 | inputPath.setNegPATH(negPath); 29 | inputPath.setPosPath(posPath); 30 | sentencePredcit.initTrain(method,inputPath); 31 | List preLabel = sentencePredcit.sensePredict("商务大床房,房间很大,床有2M宽,整体感觉经济实惠不错!"); 32 | System.out.println("预测值为: "+preLabel.get(0));*/ 33 | 34 | /* //2,采用的是词典的方式进行语义分析 35 | int method = 2; 36 | String negPath = "C:\\Users\\sssd\\Desktop\\data\\NTUSD_negative_simplified.tx"; 37 | String posPath = "C:\\Users\\sssd\\Desktop\\data\\NTUSD_positive_simplified.txt"; 38 | inputPath.setNegPATH(negPath); 39 | inputPath.setPosPath(posPath); 40 | sentencePredcit.initTrain(method,inputPath); 41 | List preLabel = sentencePredcit.sensePredict("早餐太差,全是素菜。另外礼宾部还弄丢了我一件行李,最后发现是被别人领走了,半天才找回来。其他都还可以。"); 42 | System.out.println("预测值为: "+preLabel.get(0));*/ 43 | 44 | //3,采用word-score的方式进行语义分析 45 | int method = 3; 46 | String path = "C:\\Users\\sssd\\Desktop\\data\\BosonNLP_sentiment_score.txt"; 47 | inputPath.setPath(path); 48 | sentencePredcit.initTrain(method,inputPath); 49 | 50 | List lines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\posdata.txt"), Charset.forName("UTF-8")); 51 | int posNum = 1; 52 | int posNumPre = 0; 53 | long posstartT = System.currentTimeMillis(); 54 | for (String line : lines) { 55 | List preLabel = sentencePredcit.sensePredict(line); 56 | // System.out.println(posNum + " 预测值为:"+preLabel.get(0)); 57 | posNum++; 58 | if ((Double)preLabel.get(0) > 0.0){ 59 | posNumPre++; 60 | } 61 | } 62 | long posendT = System.currentTimeMillis(); 63 | System.out.println("正面文本准确率为:"+ (double)posNumPre/(posNum-1)); 64 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", lines.size(), (posendT - posstartT), ((posendT - posstartT) / (float)posNum))); 65 | 66 | 67 | List negLines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\negdata.txt"), Charset.forName("UTF-8")); 68 | int negNum = 1; 69 | int negNumPre = 0; 70 | for (String line : negLines) { 71 | List preLabel = sentencePredcit.sensePredict(line); 72 | // System.out.println(negNum + " 预测值为:"+preLabel.get(0)); 73 | negNum++; 74 | if ((Double)preLabel.get(0) < 0.0){ 75 | negNumPre++; 76 | } 77 | } 78 | long negendT = System.currentTimeMillis(); 79 | System.out.println("反面文本准确率为:"+ (double)negNumPre/(negNum-1)); 80 | System.out.println("预测总的文本时间为:" +(negendT- posstartT)); 81 | System.out.println("平均预测一个文本时间为:" +(negendT- posstartT)/(posNum+negNum-2)); 82 | } 83 | } -------------------------------------------------------------------------------- /src/test/java/textanalysis/SentencePredict.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import com.google.common.io.Files; 4 | import org.junit.Test; 5 | 6 | import java.io.File; 7 | import java.nio.charset.Charset; 8 | import java.util.List; 9 | 10 | /** 11 | * 测试不带权值匹配词典的方法(采用的是台湾大学的情感极性词典NTUSD ) 12 | * Created by sssd on 2017/7/19. 13 | */ 14 | 15 | public class SentencePredict { 16 | 17 | @Test 18 | public void outPrint()throws Exception{ 19 | 20 | SentencePredcit sentencePredcit = new SentencePredcit(); 21 | InputPath inputPath = new InputPath(); 22 | 23 | int method = 2; 24 | String negPath = "C:\\Users\\sssd\\Desktop\\data\\NTUSD_negative_simplified.tx"; 25 | String posPath = "C:\\Users\\sssd\\Desktop\\data\\NTUSD_positive_simplified.txt"; 26 | inputPath.setNegPATH(negPath); 27 | inputPath.setPosPath(posPath); 28 | sentencePredcit.initTrain(method,inputPath); 29 | 30 | List lines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\posdata.txt"), Charset.forName("UTF-8")); 31 | int posNum = 1; 32 | int posNumPre = 0; 33 | long posstartT = System.currentTimeMillis(); 34 | for (String line : lines) { 35 | List preLabel = sentencePredcit.sensePredict(line); 36 | // System.out.println(posNum + " 预测值为:"+preLabel.get(0)); 37 | posNum++; 38 | if ((Double)preLabel.get(0) > 0.0){ 39 | posNumPre++; 40 | } 41 | } 42 | long posendT = System.currentTimeMillis(); 43 | System.out.println("正面文本准确率为:"+ (double)posNumPre/(posNum-1)); 44 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", lines.size(), (posendT - posstartT), ((posendT - posstartT) / (float)posNum))); 45 | 46 | 47 | List negLines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\negdata.txt"), Charset.forName("UTF-8")); 48 | int negNum = 1; 49 | int negNumPre = 0; 50 | for (String line : negLines) { 51 | List preLabel = sentencePredcit.sensePredict(line); 52 | // System.out.println(negNum + " 预测值为:"+preLabel.get(0)); 53 | negNum++; 54 | if ((Double)preLabel.get(0) < 0.0){ 55 | negNumPre++; 56 | } 57 | } 58 | long negendT = System.currentTimeMillis(); 59 | System.out.println("反面文本准确率为:"+ (double)negNumPre/(negNum-1)); 60 | System.out.println("预测总的文本时间为:" +(negendT- posstartT)); 61 | System.out.println("平均预测一个文本时间为:" +(negendT- posstartT)/(posNum+negNum-2)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/test/java/textanalysis/SentencePredictMlib.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import com.google.common.io.Files; 4 | import org.junit.Test; 5 | 6 | import java.io.File; 7 | import java.nio.charset.Charset; 8 | import java.util.List; 9 | 10 | /** 11 | * 对支持向量机语义分析进行测试 12 | * Created by sssd on 2017/7/19. 13 | */ 14 | public class SentencePredictMlib { 15 | @Test 16 | public void outPrint()throws Exception{ 17 | 18 | SentencePredcit sentencePredcit = new SentencePredcit(); 19 | InputPath inputPath = new InputPath(); 20 | 21 | //1,采用的是机器学习 22 | int method = 1; 23 | String negPath = "C:\\Users\\sssd\\Desktop\\data\\train\\negdata.txt"; 24 | String posPath = "C:\\Users\\sssd\\Desktop\\data\\train\\posdata.txt"; 25 | inputPath.setNegPATH(negPath); 26 | inputPath.setPosPath(posPath); 27 | sentencePredcit.initTrain(method,inputPath); 28 | 29 | List lines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\posdata.txt"), Charset.forName("UTF-8")); 30 | int posNum = 1; 31 | int posNumPre = 0; 32 | long posstartT = System.currentTimeMillis(); 33 | for (String line : lines) { 34 | List preLabel = sentencePredcit.sensePredict(line); 35 | posNum++; 36 | if ((Double)preLabel.get(0) > 0.5){ 37 | posNumPre++; 38 | } 39 | } 40 | long posendT = System.currentTimeMillis(); 41 | 42 | System.out.println("---------------------"); 43 | System.out.println("预测正面文本为:"+ posNumPre); 44 | System.out.println("正面文本准确率为:"+ (double)posNumPre/(posNum-1)); 45 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", lines.size(), (posendT - posstartT), ((posendT - posstartT) / (float)posNum))); 46 | 47 | 48 | /* 49 | List negLines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\negdata.txt"), Charset.forName("UTF-8")); 50 | int negNum = 1; 51 | int negNumPre = 0; 52 | long negstartT = System.currentTimeMillis(); 53 | for (String line : negLines) { 54 | List preLabel = sentencePredcit.sensePredict(line); 55 | // System.out.println(negNum + " 预测值为:"+preLabel.get(0)); 56 | negNum++; 57 | if ((Double)preLabel.get(0) < 0.0){ 58 | negNumPre++; 59 | } 60 | } 61 | long negendT = System.currentTimeMillis(); 62 | System.out.println("反面文本准确率为:"+ (double)negNumPre/(negNum-1)); 63 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", negLines.size(), (negendT - negstartT), ((negendT - negstartT) / (float)negNum))); 64 | 65 | System.out.println("---------------------"); 66 | System.out.println("预测总的文本时间为:" +(negendT- posstartT)); 67 | System.out.println("平均预测一个文本时间为:" +(negendT- posstartT)/(posNum+negNum-2)); 68 | */ 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/test/java/textanalysis/SentencePredictScord.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import com.google.common.io.Files; 4 | import org.junit.Test; 5 | 6 | import java.io.File; 7 | import java.nio.charset.Charset; 8 | import java.util.List; 9 | 10 | /** 11 | * 对中文词典权值进行测试 12 | * Created by sssd on 2017/7/19. 13 | */ 14 | public class SentencePredictScord { 15 | 16 | @Test 17 | public void outPrint() throws Exception{ 18 | 19 | SentencePredcit sentencePredcit = new SentencePredcit(); 20 | InputPath inputPath = new InputPath(); 21 | 22 | int method = 3; 23 | String path = "C:\\Users\\sssd\\Desktop\\data\\BosonNLP_sentiment_score.txt"; 24 | inputPath.setPath(path); 25 | sentencePredcit.initTrain(method,inputPath); 26 | 27 | List lines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\posdata3.txt"), Charset.forName("UTF-8")); 28 | int posNum = 1; 29 | int posNumPre = 0; 30 | long posstartT = System.currentTimeMillis(); 31 | for (String line : lines) { 32 | List preLabel = sentencePredcit.sensePredict(line); 33 | System.out.println(posNum + " 预测值为:"+preLabel.get(0)); 34 | posNum++; 35 | if ((Double)preLabel.get(0) > 0.0){ 36 | posNumPre++; 37 | } 38 | } 39 | long posendT = System.currentTimeMillis(); 40 | System.out.println("---------------------"); 41 | System.out.println("正面文本准确率为:"+ (double)posNumPre/(posNum-1)); 42 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", lines.size(), (posendT - posstartT), ((posendT - posstartT) / (float)posNum))); 43 | 44 | 45 | List negLines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\negdata3.txt"), Charset.forName("UTF-8")); 46 | int negNum = 1; 47 | int negNumPre = 0; 48 | long negstartT = System.currentTimeMillis(); 49 | for (String line : negLines) { 50 | List preLabel = sentencePredcit.sensePredict(line); 51 | // System.out.println(negNum + " 预测值为:"+preLabel.get(0)); 52 | negNum++; 53 | if ((Double)preLabel.get(0) < 0.0){ 54 | negNumPre++; 55 | } 56 | } 57 | long negendT = System.currentTimeMillis(); 58 | System.out.println("反面文本准确率为:"+ (double)negNumPre/(negNum-1)); 59 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", negLines.size(), (negendT - negstartT), ((negendT - negstartT) / (float)negNum))); 60 | 61 | System.out.println("---------------------"); 62 | System.out.println("预测总的文本时间为:" +(negendT- posstartT)); 63 | System.out.println("平均预测一个文本时间为:" +(negendT- posstartT)/(posNum+negNum-2)); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/textanalysis/SentencePredictScord2.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import com.google.common.io.Files; 4 | import org.junit.Test; 5 | 6 | import java.io.File; 7 | import java.nio.charset.Charset; 8 | import java.util.ArrayList; 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * 测试词权+程度副词+否定词 14 | * sssd on 2017/7/20. 15 | */ 16 | public class SentencePredictScord2 { 17 | 18 | @Test 19 | public void outPrint() throws Exception{ 20 | SentencePredcit sentencePredcit = new SentencePredcit(); 21 | InputPath inputPath = new InputPath(); 22 | inputPath.setEmotionPath("C:\\Users\\sssd\\Desktop\\data\\scoreWords.txt"); 23 | inputPath.setDenyPath("C:\\Users\\sssd\\Desktop\\data\\denyWords.txt"); 24 | inputPath.setLevelPath("C:\\Users\\sssd\\Desktop\\data\\degreeWords.txt"); 25 | int method = 4; 26 | sentencePredcit.initTrain(method,inputPath); 27 | 28 | List preLabel = sentencePredcit.sensePredict("酒店设施老化严重。作为一家五星级酒店,居然没有无烟楼层(这是前台登记的时候酒店服务员说的)"); 29 | System.out.println("预测值为:"+preLabel.get(0)); 30 | 31 | /* List lines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\posdata.txt"), Charset.forName("UTF-8")); 32 | int posNum = 1; 33 | int posNumPre = 0; 34 | List pres = new ArrayList(); 35 | long posstartT = System.currentTimeMillis(); 36 | for (String line : lines) { 37 | List preLabel = sentencePredcit.sensePredict(line); 38 | pres.add(preLabel.get(0)); 39 | // System.out.println(posNum + " 预测值为:"+preLabel.get(0)); 40 | posNum++; 41 | if ((Double)preLabel.get(0) > 0.0){ 42 | posNumPre++; 43 | } 44 | } 45 | long posendT = System.currentTimeMillis(); 46 | System.out.println("---------------------"); 47 | System.out.println("正面文本准确率为:"+ (double)posNumPre/(posNum-1)); 48 | System.out.println("正面文本最大值为:"+Collections.max(pres)); 49 | System.out.println("正面文本最小值为:"+Collections.min(pres)); 50 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", lines.size(), (posendT - posstartT), ((posendT - posstartT) / (float)posNum))); 51 | 52 | List negLines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\negdata.txt"), Charset.forName("UTF-8")); 53 | int negNum = 1; 54 | int negNumPre = 0; 55 | List negPres = new ArrayList(); 56 | long negstartT = System.currentTimeMillis(); 57 | for (String line : negLines) { 58 | List preLabel = sentencePredcit.sensePredict(line); 59 | negPres.add(preLabel.get(0)); 60 | // System.out.println(negNum + " 预测值为:"+preLabel.get(0)); 61 | negNum++; 62 | if ((Double)preLabel.get(0) < -0.0){ 63 | negNumPre++; 64 | } 65 | } 66 | long negendT = System.currentTimeMillis(); 67 | System.out.println("反面文本准确率为:"+ (double)negNumPre/(negNum-1)); 68 | System.out.println("反面文本最大值为:"+Collections.max(negPres)); 69 | System.out.println("反面文本最小值为:"+Collections.min(negPres)); 70 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", negLines.size(), (negendT - negstartT), ((negendT - negstartT) / (float)negNum))); 71 | 72 | System.out.println("---------------------"); 73 | System.out.println("预测总的文本时间为:" +(negendT- posstartT)); 74 | System.out.println("平均预测一个文本时间为:" +(negendT- posstartT)/(posNum+negNum-2));*/ 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/textanalysis/SentencePredictScord3.java: -------------------------------------------------------------------------------- 1 | package textanalysis; 2 | 3 | import com.google.common.io.Files; 4 | import org.junit.Test; 5 | 6 | import java.io.File; 7 | import java.nio.charset.Charset; 8 | import java.util.ArrayList; 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by sssd on 2017/7/31. 14 | */ 15 | public class SentencePredictScord3 { 16 | 17 | @Test 18 | public void outPrint()throws Exception{ 19 | SentencePredcit sentencePredcit = new SentencePredcit(); 20 | InputPath inputPath = new InputPath(); 21 | inputPath.setPosPath("F:\\ecplisework\\Sentiment_dict\\emotion_dict\\pos_all_dict.txt"); 22 | inputPath.setNegPATH("F:\\ecplisework\\Sentiment_dict\\emotion_dict\\neg_all_dict.txt"); 23 | inputPath.setStopWordPath("F:\\ecplisework\\Sentiment_dict\\emotion_dict\\stop_words.txt"); 24 | inputPath.setLevelPath("F:\\ecplisework\\Sentiment_dict\\emotion_dict\\degreeWords.txt"); 25 | int method = 5; 26 | sentencePredcit.initTrain(method,inputPath); 27 | 28 | /* List preLabel = sentencePredcit.sensePredict("商务大床房,房间很大,床有2M宽,整体感觉经济实惠不错!"); 29 | System.out.println(preLabel.get(0));*/ 30 | 31 | List lines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\posdata.txt"), Charset.forName("UTF-8")); 32 | int posNum = 1; 33 | int posNumPre = 0; 34 | List pres = new ArrayList(); 35 | long posstartT = System.currentTimeMillis(); 36 | for (String line : lines) { 37 | List preLabel = sentencePredcit.sensePredict(line); 38 | pres.add(preLabel.get(0)); 39 | // System.out.println(posNum + " 预测值为:"+preLabel.get(0)); 40 | posNum++; 41 | if ((Double)preLabel.get(0) > 0.0){ 42 | posNumPre++; 43 | } 44 | } 45 | long posendT = System.currentTimeMillis(); 46 | System.out.println("---------------------"); 47 | System.out.println("正面文本准确率为:"+ (double)posNumPre/(posNum-1)); 48 | System.out.println("正面文本最大值为:"+Collections.max(pres)); 49 | System.out.println("正面文本最小值为:"+Collections.min(pres)); 50 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", lines.size(), (posendT - posstartT), ((posendT - posstartT) / (float)posNum))); 51 | List negLines = Files.readLines(new File("C:\\Users\\sssd\\Desktop\\data\\train\\negdata.txt"), Charset.forName("UTF-8")); 52 | int negNum = 1; 53 | int negNumPre = 0; 54 | List negPres = new ArrayList(); 55 | long negstartT = System.currentTimeMillis(); 56 | for (String line : negLines) { 57 | List preLabe2 = sentencePredcit.sensePredict(line); 58 | negPres.add(preLabe2.get(0)); 59 | // System.out.println(negNum + " 预测值为:"+preLabel.get(0)); 60 | negNum++; 61 | if ((Double)preLabe2.get(0) < -0.0){ 62 | negNumPre++; 63 | } 64 | } 65 | long negendT = System.currentTimeMillis(); 66 | System.out.println("反面文本准确率为:"+ (double)negNumPre/(negNum-1)); 67 | System.out.println("反面文本最大值为:"+Collections.max(negPres)); 68 | System.out.println("反面文本最小值为:"+ Collections.min(negPres)); 69 | System.out.println(String.format("%d 条文本耗时 %d ms, 平均: %f ms/条", negLines.size(), (negendT - negstartT), ((negendT - negstartT) / (float)negNum))); 70 | 71 | System.out.println("---------------------"); 72 | System.out.println("预测总的文本时间为:" +(negendT- posstartT)); 73 | System.out.println("平均预测一个文本时间为:" +(negendT- posstartT)/(posNum+negNum-2)); 74 | } 75 | } 76 | --------------------------------------------------------------------------------