首页 文章

如何让这个python包工作?

提问于
浏览
-1

我必须使用以下Python包来扫描目录中的许多.txt文件,但我无法使其工作(我的编程经验非常有限):

https://pypi.org/project/readability/

有了这个程序,我应该能够扫描.txt文件,并在csv文件中获得有关其可读性的输出 . (我正在使用macOS)

这是如何使用它的描述:

$ readability --help
Simple readability measures.

Usage: readability [--lang=<x>] [FILE]
or: readability [--lang=<x>] --csv FILES...

By default, input is read from standard input.
Text should be encoded with UTF-8,
one sentence per line, tokens space-separated.

Options:
  -L, --lang=<x>   Set language (available: de, nl, en).
  --csv            Produce a table in comma separated value format on
                   standard output given one or more filenames.
  --tokenizer=<x>  Specify a tokenizer including options that will be given
                   each text on stdin and should return tokenized output on
                   stdout. Not applicable when reading from stdin.

如果我理解正确,我只需要终端来运行这个程序?我需要使用.txt文件扫描整个文件夹,并希望在csv文件中获得所有这些文件的输出 . 根据说明,这应该是可能的 .

所以我尝试使用这样的终端命令:

$ readability [--lang=<en>] --csv /Users/xxx/Desktop/SEC10K.1

但是当我按回车键时,我只在终端中收到此错误消息:

-bash: en: No such file or directory

有人可以告诉我我做错了什么吗?我该如何正确地做到这一点?谢谢 !

1 回答

  • 0

    方括号'[]'表示该参数是可选的,尖括号'<>'用于放置占位符示例,预计您将填写自己的内容 . 有关如何阅读手册页的更多信息,请键入:

    $ man man
    

    对于您的情况,您需要运行 $ readability --lang=en --csv /Users/xxx/Desktop/SEC10K.1 . 如果需要将其放入.csv文件中,请运行:

    $ readability --lang=en --csv /Users/xxx/Desktop/SEC10K.1 > out.csv
    

相关问题