Coder Social home page Coder Social logo

biq-data-backend's Introduction

つぶやきビックデータ

twitterのトレンドワードを集計するサービス

機能

  • 形態素解析でTwitterの呟きからキーワードを抜き出してグラフ化(慣用句は辞書ファイルで指定し無視)
    • リアルタイムビュー(定点。リロードしない限り更新されない)
    • 本日累計ビュー
    • 日別累計ビュー
  • キーワードをが含まれる呟き一覧を表示、またはtwitter公式にリンクする機能
    • NHKだったらNHKで検索した結果のハイライトを表示する(NHKでドラクエが人気だと分かる)
  • キーワードの元記事を抽出する機能
  • 過去のトレンドを閲覧できる仕組み(シームレスな時系列指定、日別指定など、多様な指定方法を用意)
  • 特定の話題に絞り込む機能(コミケの話題とか)
  • 興味の無い分母を取り除く機能(3代目とか)
  • ストリームビューを付ける(フィルター可能)
  • 英語と日本語に対応
  • とあるキーワードのコンテキスト内でどんな言葉が話題になっているのか検索する機能(例: 「クリスマス」というコンテキストの中でやり取りされる情報の傾向を調べる)

アーキテクチャ

  • stream apid3JS用JSONの生成をリアルタイムで行いたい
  • twitter4Jからtwitterstream取得 → kuromojiでワードを形態素解析 → ワードと規模の関係をフォーマット&ソート → D3jsonに書き出し

feature

  • ローディング不要でリアルタイムにグラフが表示されるモードを実装したい(既存の読み込み時のグラフを固定表示するモードはstaticモードとして別に残す)

研究したい内容

  • 例えば同人とか、そのカテゴリ|クラスタ|コンテキストの中での勢力構成はどうなっているのか?
  • ニュースサイト、webサービスの勢力図(シェアされた元サイトの勢力構成)
  • 主に世間の情報の流れと、特定領域にフォーカスした際の情報の流れをビジュアライズ
  • 僕も@roprossさんや@fukayatsuさんや@yositosiさんや@yusukebeみたいになりたい
  • お金の香りがする http://oras-pokemon.com/?page_id=5332
  • 情報ボリューム全体の中でのマッピング位置を確認したい

SQL

  • 特定のranking_idのキーワードとカウントを取得する
select r.id, k.keyword, ri.count from (rankings r join ranking_items ri on r.id = ri.ranking_id) join keywords k on ri.keyword_id = k.id where r.id = 4239 order by ri.count desc;
  • 全ranking_idのキーワードとカウントを集計する
select k.keyword, sum(ri.count) from (rankings r join ranking_items ri on r.id = ri.ranking_id) join keywords k on ri.keyword_id = k.id group by k.id,ri.count order by sum(ri.count) desc;
  • 直近30件のanking_idのキーワードとカウントを集計する
select k.keyword, sum(ri.count) from (rankings r join ranking_items ri on r.id = ri.ranking_id) join keywords k on ri.keyword_id = k.id where r.id in(select id from rankings order by id desc limit 30) group by k.id,ri.count order by sum(ri.count) desc;

biq-data-backend's People

Contributors

ryota-murakami avatar

Watchers

 avatar  avatar

biq-data-backend's Issues

開発→デプロイフローの構築

  • アプリケーション全体のクラスタをdockerで表現する方法を調べる
  • 開発環境 → Staging環境 → 本番環境へのデプロイをAWS用いて最も手軽に行える方法を考える
  • デプロイフローに合わせて各環境のインフラ構成を調整する

考える事

  • dockerfileは使いたくない。ローカルやCI上でプロビジョン済みのコンテナイメージを各環境にpullする方式にしたい。
  • docker-composeやteraform上でwebとsparkクラスタは分ける方が良い?
  • docker composeで開発環境を構築する方法は分かるが、開発したコードをコンテナイメージにビルドする方法は?
    → A. アプリケーションコードは実行環境のコンテナとは別に、githubベースで管理する。
  • RDSやElastic Cacheの代替はどうやってローカル環境に用意する
    → A. RDSやElastic Cacheは高いので使わ無い方針で....

kuromojiで謎のアラビア文字のようなものがコンソールに出力されるのを直す

概要

このページのコードをコピペして動かしてみたんだけどアラビア文字コンソール出力に出てしまう。http://www.intellilink.co.jp/article/column/bigdata-kk01.html
これを直したい。

2016-12-13 19 41 20


コンソール出力している部分のコードは以下の様になっているから、 文字列の末尾にアラビア文字みたいなのが表示されるのは普通に見ておかしい。
topList.foreach{case (count, tag) => println(s"$tag ($count tweets)")}

調査ログ

文字コードの設定はどうなってる?

A. ちゃんとUTF-8になっている。もちろんソースファイルもUTF-8。

ryota.murakami@murakami ~/r/twitterpulse> activator console
[info] Loading project definition from /Users/ryota.murakami/repository/twitterpulse/project
[info] Updating {file:/Users/ryota.murakami/repository/twitterpulse/project/}twitterpulse-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to otkm (in build file:/Users/ryota.murakami/repository/twitterpulse/)
[info] Updating {file:/Users/ryota.murakami/repository/twitterpulse/}twitterpulse...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/ryota.murakami/repository/twitterpulse/target/scala-2.11/classes...
[info] Starting scala interpreter...
[info] 
import main._
Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions to have them evaluated.
Type :help for more information.

scala> scala.io.Codec.default.charSet
res0: java.nio.charset.Charset = UTF-8

scala> 

kuromojiで生成された変数をprintln()から外したらどうなる?

A. アラビア文字っぽいのは出なくなった。kuromojiが原因の可能性が高い。

  • コード
            //topList.foreach{case (count, tag) => println(s"$tag ($count tweets)")}
            topList.foreach{case (count, tag) => println("tag (count tweets)")}
  • 出力
16/12/13 19:58:53 INFO TwitterStreamImpl: Establishing connection.
16/12/13 19:58:53 INFO TwitterStreamImpl: Establishing connection.
¥n Popular topics in last 60*60 seconds (2091 words):
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)
tag (count tweets)

やっぱりアラビア語?

unicorde番号調べてたらやっぱりアラビア語っぽい。
以下ページの06番台の文字がリストに格納されている。
https://ja.wikipedia.org/wiki/Unicode%E4%B8%80%E8%A6%A7_0000-0FFF

TwitterStreamからアラビア語のツイートも取得されているようなので、これが結果のリストに含まれているのでは?

2016-12-13 20 52 56

なんかタイ語も取れてるwしかも「ひらがなが含まれているツイートのみ」入るはずのif文を通過しているぞ

2016-12-13 21 07 17

ひらがなが含まれていないのに「ひらがなが含まれているツイートのみ」if文がtrueになってるぞ!

2016-12-13 22 26 41

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.