Can we have a tokenizer output on a single line like that of Apache OpenNLP with the command line tool?
http://nlp.stanford.edu/software/tokenizer.shtml
https://opennlp.apache.org/documentation/1.5.3/manual/opennlp.html#tools.tokenizer
You can use DocumentPreprocessor, either programmatically or from the command line.
From the CLI:
$ echo "This is a test. And some more." | java edu.stanford.nlp.process.DocumentPreprocessor 2>/dev/null
This is a test .
And some more .
You can do the same thing programmatically; see this SO answer.
Related
In order to generate dynamically the version in my sbt project I am using the sbt-dynver plugin. But in order to integrate the build system, I would like to obtain the version string from a bash script, something like:
DYNVER=`sbt dynver`
But the previous command does not return anything.
I managed to get what I wanted by adding the 'show' command to sbt and parsing the output value, as follows:
VERSION=`sbt "show dynver" | grep -oE "\w{7}-\w{8}-\w{4}"`
echo $VERSION
4bbbb2a-20171022-1508
The simplest solution is to ignore other SBT output by taking last line.
Also it's better to print out version instead of dynver as it affects overrides from your version.sbt file.
VERSION=$(sbt 'print version' | tail -n 1)
echo $VERSION
0.1.7-2-6853afe4
Currently I am learning bash scripting.
So, I wanted to know how can I modify the output of linux command.
To be specific, I entered a command and after pressing enter, every line should start with an '->' or any symbol.
E.g: In arch-linux, when we use pacman or yaourt to install packages,
we get "==>" "->" "::" proceeding with some information.
I want output somewhat similar to that.
Not sure I get what you are trying to do but… are you looking for something such as:
function pprint() {
echo "==> " $1
}
Which you can use as such in your scripts:
pprint "Hey there"
To output the following:
===> Hey there
I am using Doxygen to generate HTML documentation and then run a Perl script to get function names.
To run Doxygen configuration, I need to run doxygen file_name in cmd.
But I want to run everything from Perl.
I tried this code
my $cmd = "perl -w otherscript.pl";
my $result = system("start $cmd");
But it just opens a cmd window. I need to execute cmd code directly through Perl (not a Perl command line, but through a Perl IDE). Is there a way to achieve this?
Your usage of system and start is OK.
From your description in the comment, I think it's because you're not using the correct escaping method when giving configure files to Doxygen that it throws such an error:
Error: configuration file C:SERSGHOSHBCD not found!
Try with
my $result = `doxygen C:\\Users\\aghosh\\abcd`;
In the two back-slashes, the former one is to escape the latter one, so that it's recognized by Windows as the directory separator.
I have written a shell script with commands like:
version=$1;
sed -i 's/def version = ".*"/def version = "'$version'"/' $file;
grails package-plugin;
echo -n 'Enter description of new version: ';
read desc;
git commit -m "$desc";
I want to convert it into a groovy script i.e, to create a custom grails-command that does the same thing, using GANT.
I searched a lot. But, I'm unable to find the proper methods in Apache Ant API to run a linux command like above.
Please suggest me a solution to my shell-script code with equivalent GANT script
Atleast suggest me where to start with to achieve my task.
Thank you very much in advance...
Well at last, I have figured it out how to perform the above said task.
Thanx to Grails documentation and Apache Ant tasks manual . .
After taking a whole day time, I observed that for any task to be performed:
one can refer to Apache Ant manual first,
Find it in the index,
and then knowing its usage along with necessary arguments and examples given in XML,
Then observe how XML syntax is converted to corresponding Groovy script i.e., GANT script
For e.g., observe the mkdir task and its corresponding usage in grails doc example i.e., use ant variable, then . task-name [ arguments-map ]
For those shell commands which don't have a direct task in Apache Ant manual, use exec() to run the command
That's it ... task complete :)
I'm trying to write a quick batch file. It will take the result of a command, put some extra text and quotes around it, and put that into a new file.The problem is that the result of the command I'm running includes a new line. Here's the command:
p4 changelists -m 1 -t //depot/...> %FILENAME%
The output of that p4 command has a newline at the end of it. The file I'm putting it into needs to have quotes surrounding the output of that command, but the fact that the command contains a newline in it means that the "closing quote" appears on a new line in the file, which doesn't work for what I'm doing.
I've tried writing the output of that command into a file and reading it back in, and also trying to run FINDSTR on a file containing the output, but I always seem to get back the stupid trailing whitespace. I've even tried inserting backspaces into the file, but that just put a backspace character into the file instead of actually executing a backspace...
Is there anything to be done about this?
I'm no perl wizard, but the following seems to work:
p4 changelists -m 1 -t //depot/...| perl -p -e "s/^/\042/;s/$/\042/"
Check out Strawberry Perl, which provides a Windows version of Perl.
I'm always looking at my Unix tools when solving problems like this, even under Windows. sed and gawk will also get you there, check out msysgit for a nice bundle of Unix tools that will run on Windows.