既存モデルに基づく感情分析システム

2043 ワード

既存モデルに基づく感情分析システム
コード接続https://github.com/gitstliu/SentimentAnalysis
  • word 2 vecアルゴリズム
  • に基づく
  • 外食評価データとホテル評価データを用いて訓練された感情分析モデル
  • 使用前に言語の先分詞が必要であり、分詞結果はシステムの入力パラメータとして、簡単な研究開発でサービスインタフェースを実現することができる.
  • 自分で単語を分けるデータセットがあれば、著者に連絡して対応するモデルの訓練を手伝うこともできる.

  • WEBサービスの作成
    # encoding: utf-8
    from flask import Flask, request, jsonify
    import json
    import SentimentAnalysis.predict.predict as predict
    
    app = Flask(__name__)
    predictmodel = predict.createpredict("SentimentAnalysis/models/svm.pickle", "SentimentAnalysis/models/svm.chisquare")
    
    @app.route("/", methods=("POST",))
    def index():
        data = json.loads(request.data)
        results = []
        for words in data['words']:
            if predict.predict(predictmodel, words) == 1:
                result = "  "
            else:
                result = "  "
            results.append(result)
        return jsonify({'results': results})
    
    if __name__ == '__main__':
        app.run(host='0.0.0.0',debug=False, port=10000)

    何か質問があれば直接メッセージをお願いします