selfteaching / selfteaching/selfteaching-python-camp

Day10 如何处理jieba库cut函数的返回值

Open
#946 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
151
Forks
875
PR merge metrics
No merged PRs in 30d

Description

cut函数的文档并没有标注其返回值,搜索引擎搜索之后发现其返回值是一个“生成器”(一脸懵逼)

处理cut函数返回值的方法如下:

    import jieba
    text='今天天气真好,我要出去跑步'
    print(','.join(jieba.cut(text)))

输出结果为:

今天天气,真,好,,,我要,出去,跑步

可见print函数中的逗号','是分隔分词的

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the repository for the documentation entry for jieba.cut and read the surrounding explanation and examples. Document that cut returns a generator and clarify how the shown Python example consumes it; done means the return value and usage are clear to readers.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.