1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[分析業務] 会話ログの定性的分析で、Google NotebookLMが最強すぎた

Last updated at Posted at 2025-09-28

ユーザデータ(年齢、性別等)やユーザごとの会話ログが入っているCSVデータから、会話ログの分析を行う際に、今までPythonで定量的分析を行っていた。だが、定性的な分析(要約等)はどうしても主観的になってしまうので、どうしたら良いか悩んでいた。そうした中、ここ最近の数日、Googleのnotebook LMを使って会話内容の傾向などの定性的な分析をやってみたら最強すぎたので、この感動を届けたい。

1.Pythonによる定量的分析

Pythonは計算処理が得意なので、年齢性別別の割合、会話ログでの頻出単語、会話の最初・最後の文の抽出、会話の感情スコア計算、連続発話回数、質問文割合など、定量的に数字を出す分析はPythonでやっている。
例えば、デモグラフィックデータの抽出は、年齢を10代、20代、30代...とグループ化し、年代×性別ごとのユーザ母数、年代×性別ごとの発言母数などを計算した。
以下は年齢性別別に頻出単語の抽出するスクリプトだ。このようなことはPythonでできる。

import pandas as pd
import re
from collections import Counter
import MeCab

# ===== 1. CSV読み込み =====
df = pd.read_csv("conversations_data.csv")

# ===== 2. 年齢グループ化 =====
df["age_group"] = pd.cut(
    df["age"],
    bins=[0,19,29,39,49,59,69,120],
    labels=["10代以下","20代","30代","40代","50代","60代","70代以上"]
)

# ===== 3. 会話ログを1発言ごとに分解 =====
def extract_messages(log_text):
    if pd.isna(log_text):
        return []
    # "メッセージ" 部分だけを取り出す
    return re.findall(r'\"(.*?)\"', log_text)

df["messages"] = df["user_talks"].apply(extract_messages)
df_expanded = df.explode("messages").dropna(subset=["messages"])

# ===== 4. ノイズ除外 =====
stop_msgs = ["画像", "スタンプ", "はい", "うん", "そうですね。"]
df_expanded = df_expanded[~df_expanded["messages"].isin(stop_msgs)]

# ===== 5. 形態素解析(MeCab) =====
mecab = MeCab.Tagger()

# ストップワードリスト(必要に応じて追加)
stop_words = set([
    "する","なる","ある","いる","こと","","思う","いう",
    "ござい","下さい","れる","られる","られ","n","I","you",
    "the","to","de","je","mon","",""
])

def tokenize(text):
    words = []
    node = mecab.parseToNode(text)
    while node:
        features = node.feature.split(",")
        if features[0] in ["名詞","動詞","形容詞"]:
            surface = node.surface.strip()
            # 2文字以上で、ストップワードじゃなく、日本語のみ
            if (len(surface) > 1 
                and surface not in stop_words 
                and re.match(r"^[\u3040-\u30ff\u4e00-\u9faf]+$", surface)):
                words.append(surface)
        node = node.next
    return words

# ===== 6. グループごとに頻出単語集計 =====
summary_texts = []
for (age_group, gender), group_df in df_expanded.groupby(["age_group","gender"], observed=True):
    if group_df.empty:
        continue
    
    all_words = []
    for msg in group_df["messages"]:
        all_words.extend(tokenize(str(msg)))
    
    counter = Counter(all_words).most_common(20)  # 上位20単語
    
    summary_texts.append(f"=== {age_group}-{gender} ===")
    summary_texts.append(f"発言数: {len(group_df)}")
    
    if counter:
        summary_texts.append("頻出単語トップ20:")
        for word, freq in counter:
            summary_texts.append(f"{word}: {freq}")
    else:
        summary_texts.append("  ※有効な単語が見つかりませんでした")
    summary_texts.append("\n")

# ===== 7. 結果をテキストに保存 =====
with open("conversation_summary.txt", "w", encoding="utf-8") as f:
    f.write("\n".join(summary_texts))

print("サマリーを conversation_summary.txt に保存しました。")

2.Google NotebookLMでの定性的分析

周りの方に「どうやらNotebookLMが良い」と勧めれたので、試してみたら驚いた。
NotebookLMの何が凄いかというと、会話の傾向の要約などの定性的な分析が一瞬で高品質できてしまうことだ。
手順としては超簡単で、(1)NotebookLMにアクセスしブラウザ上にテキストデータをアップロードする。
NotebookLM: https://notebooklm.google.com/
スクリーンショット 2025-09-28 午後4.01.15.png

(2)その後、プロンプトで例えば「ユーザが発話した内容を抽出しております。その中で、アプリのサービス・機能に関する不満やサービス改善につながるようなコメントをカテゴリーに分けて一覧で示してください。」と指定すると、そのサマリーを一瞬(データ量によるが10秒ぐらい)で出してくれる。つまり、ChatGTPやClaudeの文章要約のようなことを実際のログデータから簡単にやってくれるのだ。分析系の業務をやられている方は是非試してみてほしい。感動すると思う。

結論

最近自分は、定量的分析はPythonでやって、定性的分析はGoogle NotebookLMというふうに使い分けて作業している。分析業務でNotebookLMを使ったことがない方は是非おすすめ!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?