c++ - 如何使用 linux 命令传递输入和配置文件

标签 c++ linux parameters command-line-arguments

我有一个可执行文件 vs-vectorize,我想为其传递一个文件以分析及其配置文件。我对 Linux 非常陌生,所以请原谅我的问题。


要分析的文件是xml格式:

<doc id="E0211315">
<text>
Gimme Dat

For the Chris Brown song, see Gimme That

"Gimme Dat" is the second single released off of Chingy's fourth album, Hate It
or Love It. The single features Ludacris and Bobby Valentino.

The video premiered on MTV's TRL and BET's 106 & Park on February 8, 2008. The
song however failed to chart making it his second consecutive single flop from
the album.

 Charts
</text>
</doc>

参数如下:

Usage:
  vectorize --conf=.. --language=.. [--xml-conf=..] --output=.. files 
Options:
  -h [ --help ]         Display this help message
  --conf arg            XML config file
  --xml-conf arg        configuration file for xml analysis (to interpret xml 
                        format of input file)
  --language arg        language of the documents
  --output arg          prefix of the files for outputs


--conf
This option allows to specify the name of the configuration file to use: this file contains all the parameters used for the different steps of the construction of the vector representation (Analyzers, LexiconBuilder, VectorBuilder). More details on the content of the configuration file are given in this page: Configuration File.

--xml-conf
This option allows to specify the name of a configuration file that indicates how to parse the xml input file. This configuration file should respect the XML format defined here: XML Format for the input file parser configuration.

--language
This option specifies the language of the documents (useful in the linguistic analysis step).

--output
This option specifies the base name for the output files created by this program. The main output file containing the vectors will be base.data. If this argument is not set, the base name of the first input file is used (without .xml or .txt extension).

我传递的参数如下:

./vs-vectorize documents.xml --conf vs-config.xml --xml-conf configuration.xml

其中documents.xml是要分析的输入文件,其他是参数文件。

一些修改:

./vs-vectorize --conf="/home/hani/workspace/textvector/conf/vs-config.xml" --language="Eng" --xml-conf="/home/hani/workspace/textvector/release/src/vs-vectorize/configuration.xml" /home/hani/workspace/textvector/release/src/vs-vectorize/documents.xml

什么都没有出来为什么?我做错了什么?

最佳答案

传递文件的完整路径,例如:/home/hani/documents.xml 而不仅仅是文件名。

关于c++ - 如何使用 linux 命令传递输入和配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28941051/

相关文章:

C++ 从具有已知基类的未知中间类继承

linux - 如何测试变量是否是 bash 中的字符串?

google-chrome - 在 chrome.tabs.executeScript 中,如何调用具有位于 contentscript 中的参数的函数?

c++ -/usr/bin/ld : cannot find -lopencv_contrib

c++ - 我的程序跳过返回语句

linux - 链接两个不同版本的库

c++ - While Loop 不会循环 C++

parameters - Encog 模拟退火参数

c++ - 模运算符如何工作?

c - 在 OS X 和 Linux 下使用 automake 构建 C