python 预编译命令_Python子进程调用预编译j
这可以从windows命令行执行:c:\mallet\bin\mallet run
我试过了
^{pr2}$
然后得到一个错误WindowsError: [Error 2] The system cannot find the file specified
我试过了subprocess.call(['c:/mallet/bin/mallet', 'run'])
然后找出错误WindowsError: [Error 193] %1 is not a valid Win32 application
我要传给什么subprocess.call()? 在
为了完整起见,我想传递的完整命令是:bin\mallet run cc.mallet.topics.tui.DMRLoader texts.txt features.txt instance.mallet
我模糊的想法是这是一个预编译的java类,我正在以某种方式调用它,但我并不真正理解我在这里做什么。在
以下是文件夹bin中的两个mallet文件:
mallet.bat@echo off
rem This batch file serves as a wrapper for several
rem MALLET command line tools.
if not "%MALLET_HOME%" == "" goto gotMalletHome
echo MALLET requires an environment variable MALLET_HOME.
goto :eof
:gotMalletHome
set MALLET_CLASSPATH=%MALLET_HOME%\class;%MALLET_HOME%\lib\mallet-deps.jar
set MALLET_MEMORY=1G
set MALLET_ENCODING=UTF-8
set CMD=%1
shift
set CLASS=
if "%CMD%"=="import-dir" set CLASS=cc.mallet.classify.tui.Text2Vectors
if "%CMD%"=="import-file" set CLASS=cc.mallet.classify.tui.Csv2Vectors
if "%CMD%"=="import-smvlight" set CLASS=cc.mallet.classify.tui.SvmLight2Vectors
if "%CMD%"=="train-classifier" set CLASS=cc.mallet.classify.tui.Vectors2Classify
if "%CMD%"=="train-topics" set CLASS=cc.mallet.topics.tui.Vectors2Topics
if "%CMD%"=="infer-topics" set CLASS=cc.mallet.topics.tui.InferTopics
if "%CMD%"=="estimate-topics" set CLASS=cc.mallet.topics.tui.EstimateTopics
if "%CMD%"=="hlda" set CLASS=cc.mallet.topics.tui.HierarchicalLDATUI
if "%CMD%"=="prune" set CLASS=cc.mallet.classify.tui.Vectors2Vectors
if "%CMD%"=="split" set CLASS=cc.mallet.classify.tui.Vectors2Vectors
if "%CMD%"=="bulk-load" set CLASS=cc.mallet.util.BulkLoader
if "%CMD%"=="run" set CLASS=%1 & shift
if not "%CLASS%" == "" goto gotClass
echo Mallet 2.0 commands:
echo import-dir load the contents of a directory into mallet instances (one per file)
echo import-file load a single file into mallet instances (one per line)
echo import-svmlight load a single SVMLight format data file into mallet instances (one per line)
echo train-classifier train a classifier from Mallet data files
echo train-topics train a topic model from Mallet data files
echo infer-topics use a trained topic model to infer topics for new documents
echo estimate-topics estimate the probability of new documents given a trained model
echo hlda train a topic model using Hierarchical LDA
echo prune remove features based on frequency or information gain
echo split divide data into testing, training, and validation portions
echo Include --help with any option for more information
goto :eof
:gotClass
set MALLET_ARGS=
:getArg
if "%1"=="" goto run
set MALLET_ARGS=%MALLET_ARGS% %1
shift
goto getArg
:run
java -Xmx%MALLET_MEMORY% -ea -Dfile.encoding=%MALLET_ENCODING% -classpath %MALLET_CLASSPATH% %CLASS% %MALLET_ARGS%
:eof
和mallet#!/bin/bash
malletdir=`dirname $0`
malletdir=`dirname $malletdir`
cp=$malletdir/class:$malletdir/lib/mallet-deps.jar:$CLASSPATH
#echo $cp
MEMORY=1g
JAVA_COMMAND="java -Xmx$MEMORY -ea -Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -classpath $cp"
CMD=$1
shift
help()
{
cat <
Mallet 2.0 commands:
import-dir load the contents of a directory into mallet instances (one per file)
import-file load a single file into mallet instances (one per line)
import-svmlight load SVMLight format data files into Mallet instances
train-classifier train a classifier from Mallet data files
classify-dir classify data from a single file with a saved classifier
classify-file classify the contents of a directory with a saved classifier
classify-svmlight classify data from a single file in SVMLight format
train-topics train a topic model from Mallet data files
infer-topics use a trained topic model to infer topics for new documents
evaluate-topics estimate the probability of new documents under a trained model
hlda train a topic model using Hierarchical LDA
prune remove features based on frequency or information gain
split divide data into testing, training, and validation portions
Include --help with any option for more information
EOF
}
CLASS=
case $CMD in
import-dir) CLASS=cc.mallet.classify.tui.Text2Vectors;;
import-file) CLASS=cc.mallet.classify.tui.Csv2Vectors;;
import-svmlight) CLASS=cc.mallet.classify.tui.SvmLight2Vectors;;
train-classifier) CLASS=cc.mallet.classify.tui.Vectors2Classify;;
classify-dir) CLASS=cc.mallet.classify.tui.Text2Classify;;
classify-file) CLASS=cc.mallet.classify.tui.Csv2Classify;;
classify-svmlight) CLASS=cc.mallet.classify.tui.SvmLight2Classify;;
train-topics) CLASS=cc.mallet.topics.tui.Vectors2Topics;;
infer-topics) CLASS=cc.mallet.topics.tui.InferTopics;;
evaluate-topics) CLASS=cc.mallet.topics.tui.EvaluateTopics;;
hlda) CLASS=cc.mallet.topics.tui.HierarchicalLDATUI;;
prune) CLASS=cc.mallet.classify.tui.Vectors2Vectors;;
split) CLASS=cc.mallet.classify.tui.Vectors2Vectors;;
bulk-load) CLASS=cc.mallet.util.BulkLoader;;
run) CLASS=$1; shift;;
*) echo "Unrecognized command: $CMD"; help; exit 1;;
esac
$JAVA_COMMAND $CLASS $*
python 预编译命令_Python子进程调用预编译j相关推荐
- python使用shell命令_python 调用shell命令的方法
在python程序中调用shell命令,是件很酷且常用的事情-- 1. os.system(command) 此函数会启动子进程,在子进程中执行command,并返回command命令执行完毕后的退出 ...
- python编译成c代码_python如何调用c编译好可执行程序
以下总结出几种在Python 中调用 C/C++ 代码的方法 -------------------------------------------------------------------- ...
- python更新的命令_python升级命令
广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 如果您细心对比过 json python sdk 和 xml python sd ...
- python pip工具命令_python 工具链 包管理工具 pip
Installation mac下可以采用 brew,easy_install(python自带)等方式安装. centos下可以采用yum,easy_install等方式安装. 但是上面两种方式在系 ...
- python shell常用命令_python执行shell命令
1 os.system 可以返回运行shell命令状态,同时会在终端输出运行结果 例如 ipython中运行如下命令,返回运行状态status os.system('cat /etc/passwdqc ...
- python 执行ping命令_Python黑科技:在家远程遥控公司电脑,python+微信一键连接!...
有时候需要远程家里的台式机使用,因为我平时都是用 MAC 多,但是远程唤醒只能针对局域网,比较麻烦,于是我想用微信实现远程唤醒机器. 准备工作 本程序主要是实现远程管理 Windows10操作系统的开 ...
- python显示外部命令_Python 执行外部指令
1.os.system() 阻塞 屏幕会打印命令的输出 返回命令结果码 # -*- encoding=utf-8 -*- import os if __name__ == '__main__': pa ...
- python执行bat文件_Python中调用PowerShell、远程执行bat文件实例
python调用本地powershell方法 1.现在准备一个简陋的powershell脚本,功能是测试一个IP列表哪些可以ping通: function test_ping($iplist) { f ...
- python执行adb命令_Python实现对adb命令封装
我就废话不多说了,大家还是直接看代码吧! #!/usr/bin/evn python # -*- coding:utf-8 -*- # FileName adbtools.py # Author: H ...
最新文章
- VLAN系列二: 实现VLAN的机制
- javaScript面向对象表示
- selenium+java初级学习笔记之单个元素定位
- AutoLayout--masonry使用
- java 空包_圆通快递接口,圆通快递礼品商城接口、圆通空包接口,圆通快递低价接口,礼品商城接口、一件代发接口...
- struct timeval结构体 以及 gettimeofday()函数
- 【Flink】Flink Dump of the process-tree for container Exit code is 143
- win10换源安装opencv-python
- 鼠标移上图标字体,让其旋转
- Python教程:while 循环用法讲解
- Apache Doris 原理与实践
- 试题 基础练习 数的读法
- dilink虚拟服务器怎么设置,最简单的dlink路由器设置教程
- 立创开源 BGA162芯片开发
- 非线性悬架matlab,基于MATLAB/Simulink的油气悬架非线性阻尼特性分析
- 朝曦建筑建材租赁管理系统
- openjdk11 安装配置
- 讯鸟建中国首个政府云计算平台
- 【英语】五月,英语如影随形
- Install alipay支付宝安全控件 on firefox in linux
热门文章
- pandas.Series.multiply()含义解释
- 1.3.1 单隐层网络的数学实现
- JavaScript(数据类型、字符串操作)
- ASP.NET WebApi 基于分布式Session方式实现Token签名认证
- php.exe php-cgi.exe php-win.exe的区别
- gnuradio 使用eclipse 编辑器记录
- @resource 与 @autowired
- 百度定位sdk使用说明
- 关于NSString,NSMutableString,NSArray,NSMutableArray,NSDictionary,NSMutableDictionary
- puppet 工作原理