【发布时间】:2016-08-05 19:20:30
【问题描述】:
有没有技巧可以通过 mac 上的终端在 Mallet 中使用带空格的文件路径?
例如,以下所有内容都会给我错误:
逃离空间
./bin/mallet import-dir --input /Volumes/Macintosh\ HD/Users/MY_NAME/Desktop/en --output /Users/MY_NAME/Desktop/en.mallet --remove-stopwords TRUE --keep-sequence TRUE
双引号,没有转义
./bin/mallet import-dir --input "/Volumes/Macintosh HD/Users/MY_NAME/Desktop/en" --output /Users/MY_NAME/Desktop/en.mallet --remove-stopwords TRUE --keep-sequence TRUE
并且,用双引号
./bin/mallet import-dir --input "/Volumes/Macintosh\ HD/Users/MY_NAME/Desktop/en" --output /Users/MY_NAME/Desktop/en.mallet --remove-stopwords TRUE --keep-sequence TRUE
最后是单引号
./bin/mallet import-dir --input '/Volumes/Macintosh\ HD/Users/MY_NAME/Desktop/en' --output /Users/MY_NAME/Desktop/en.mallet --remove-stopwords TRUE --keep-sequence TRUE
他们都想把文件夹当成多个文件夹,在空间上分割:
Labels =
/Volumes/Macintosh\
HD/Users/MY_NAME/Desktop/en
Exception in thread "main" java.lang.IllegalArgumentException: /Volumes/Macintosh\ is not a directory.
at cc.mallet.pipe.iterator.FileIterator.<init>(FileIterator.java:108)
at cc.mallet.pipe.iterator.FileIterator.<init>(FileIterator.java:145)
at cc.mallet.classify.tui.Text2Vectors.main(Text2Vectors.java:322)
除了将所有带有空格的文件重命名为下划线之外,还有其他方法吗? (我知道我不需要输入 /Volumes/Macintosh\ HD/...,但可以从 /Users 开始。这只是一个示例。)
【问题讨论】:
-
尝试使用不带反斜杠的双引号
-
同样的错误,我会用那个信息更新问题。
-
看到这个github issue