When I use CRF++ toolkit for the first time. I have installed it and when I run the crflearn command I'am getting this message :
CRF++: Yet Another CRF Tool Kit Copyright (C) 2005-2013 Taku Kudo, All rights reserved. encoder.cpp(340) [feature_index.open(templfile, trainfile)] feature_index.cpp(135) [ifs] open failed: template_file
Can anyone help me?
The package is pretty well documented here
Can you give the full command you tried to use?
The pattern is crf_learn -t [template_file] [data_file_in_the_right_format]
The package comes with an example template file, here's the head of mine:
U00:%x[-5,0]
U01:%x[-4,0]
U02:%x[-3,0]
U03:%x[-2,0]
U04:%x[-1,0]
U05:%x[0,0]
The data needs to be in a tab delimited format with each data point represented by a row, each column is the feature value for that row and the final column is your gold standard label.
Does that help?
You put wrong file path for template featurefile and model. So, put these files inside CRF-PP folder and fire the crf_learn command. Hope this will solve your issue.
Related
I am working with ESAPI to try and validate windows directory paths. For some reason, the part of my directory path named \14\ is getting converted into a CRLF. The error I am receiving is below, what am I not understanding correctly? I feel like my regex should be working.
WARN IntrusionDetector [SECURITY FAILURE Anonymous:null#unknown -> /project-test/IntrusionDetector] Invalid input: context=directoryPath, type(DirectoryName)=^[a-zA-Z0-9:/\\!##$%^&{}\[\]()_+\-=,.~'` ]{1,255}$, input=C:\UsersTESTUS~1AppDataLocalTempTestCase8002TempWorkSpace, orig=C:\Users\TESTUS~1\AppData\Local\Temp\14\TestCase8002TempWorkSpace
As you can see, I am using the regex:
^[a-zA-Z0-9:/\!##$%^&{}[]()_+-=,.~'` ]$
My input is:
C:\Users\TESTUS~1\AppData\Local\Temp\14\TestCase8002TempWorkSpace
Ouput, after ESAPI does canonicalization and validation:
C:\UsersTESTUS~1AppDataLocalTempTestCase8002TempWorkSpace
Here is the line of code that causes me to receive the error;
String validatedSourcePath = ESAPI.validator().getValidInput("directoryUnzip", directory, "DirectoryName", 255, false);
File validFile = new File(validatedSourcePath);
#C.Williams: I was about 30 minutes into writing up a detailed reply in an editor and accidentally excited my editor window. I'm too ticked off at my stupidity of not saving it to write it again, especially since I was only about 75% done.
However, if you want to email me I can arrange to talk to you via Google Hangouts or Signal to tell you want your problem is and how you can fix it. But it's long and complicated and partially related to a bug the ESAPI team just fixed but is not in any official release yet. But I am not going to take another 45 minutes or more trying to reply with any written text. My email address should be easy enough to find. Just google for my name and ESAPI. I am one of the project co-leaders on ESAPI.
-kevin wall
Hi can somebody help me fix this.
My texture on item is not loading.
I'm modding in eclipse on minecraft 1.9.4
Here is a github page with source code :
Github page
Here is a gist with a console log :
Console log
I hope somebody knows more than me :)
You have a few problems with your code:
Your file is named ItemSlome, it would only search for itemslome, because (Model)ResourceLocations will be turned to lower-case.
The ModelResourceLocation you created is for slome not itemslome.
Your file is in the "ktm" domain, but you did not provide this to the ModelResourceLocation causing it to search in the "minecraft" domain.
Solutions:
Make the model file's name all lower-case
Make the model file's name match your code
Prepend the model name by your domain "ktm:" the ":" is the seperator for the domain part and the resource part or use a ResourceLocation instead of the String.
Additional Hints:
You may want to use ModelLoader.setCustomModelResourceLocation(...) to register your ModelResourceLocation.
Examples for a correct ModelResourceLocation:
new ModelResourceLocation("ktm:slome", "inventory"))
new ModelResourceLocation(new ResourceLocation("ktm","slome"),"inventory")
Both of the above examples will lead to the model being searched at resource_root/ktm/models/item/slome.json
This is how you set the texture of a block you have to put a colon after The Mod Name instead of comma
YourItemName = new Item().setUnlocalizedName("YourItemName")
.setTextureName("ModName:PutTextureNameHere")
.setCreativeTab(TheTabYouWantItToBeIn);
This is my first time with intellisense so please go easy on me :)
I'm using Java swing for building a search engine for viewing XML files .
At the moment the XML file is uploaded and searched successfully , however I still
would like to add the intellisense element to the project .
It's very hard to be specific since the code is pretty big , then I'll do my best to be
as specific as I could .
Here is a visual picture of the XML search engine :
Now , after the user uploaded the XML file (using the open button on the left)
he enters a query in the **current path:* box . Each part of the query is separated via / , hence what I want is to give to the user my options when he hits / , which they are :
String[] axesTypes = {"child::", "attribute::", "descendant::",
"descendant-or-self::", "slef::", "parent::",
"following-sibling::", "preceding-sibling::",
"ancestor-or-self::", "ancestor::", "following::",
"preceding::" ,"preceding::", "namespace::", "node()"};
I'd appreciate if someone can give an explanation regarding how to add that element to my project .
If you need me to post the code - please say so , and I would .
Regards
My requirement is simple. At the beginning of each file there should be a block comment like this:
/*
* This file was last modified by {username} at {date} and has revision number {revisionnumber}
*/
I want to populate the {username}, {date} and {revisionnumber} with the appropriate content from SVN.
How can I achieve this with NetBeans and Subversion? I have searched a lot but I can't find exactly what I need.
I looked at this question and got some useful information. It is not exactly duplicate because I am working with NetBeans but the idea is the same. This is my header:
/*
* $LastChangedDate$
* $LastChangedRevision$
*/
Then I go to Team > Subversion > Svn properties and add svn:keywords as property name and LastChangedDate LastChangedRevision as property value.
And when I commit from NetBeans it looks like this:
/*
* $LastChangedDate: 2012-02-13 17:38:57 +0200 (Пн, 13 II 2012) $
* $LastChangedRevision: 27 $
*/
Thanks all for the support! I will accept my answer because other answers do not include the NetBeans information. Nevertheless I give +1 to the other answers.
As this data only exists after the file was committed it should be set by SVN itself, not a client program. (And client-side processing tends to get disabled or not configured at all.) This means there is no simple template/substitute like you want, because then after the first replacement the template variables would be lost.
You can find information abut SVN's keyword substitution here. Then things like $Rev$ can be replaced by $Rev: 12 $.
You can do this with The SubWCRev Program.
SubWCRev is Windows console program which can be used to read the
status of a Subversion working copy and optionally perform keyword
substitution in a template file. This is often used as part of the
build process as a means of incorporating working copy information
into the object you are building. Typically it might be used to
include the revision number in an “About” box.
This is typically done during the build process.
If you use Linux, you can find a Linux binary here. If you wish, you could also write your own using the output of svn log.
I followed Petar Minchev's suggestions, only I put the $LastChangedRevision$ tag not in a comment block but embedded it in a string. Now it is available to programmatically display the revision number in a Help -> About dialog.
String build = "$LastChangedRevision$";
I can later display the revision value in the about dialog using a String that has all of the fluff trimmed off.
String version = build.replace("$LastChangedRevision:", "").replace("$", "").trim();
I recommend a slightly different approach.
Put the following header at the top of your source files.
/*
* This file was last modified by {username} at {date} and has revision number {revisionnumber}
*/
Then add a shell script like this
post update, checkout script
USERNAME=# // use svnversion to get username
DATE=# // use svnversion to get revisio nnumber
sed -e "s#{username}#${USERNAME}#" -e "s#{date}#${DATE}#" ${SOURCE_CONTROL_FILE} > ${SOURCE_FILE}
pre commit script
cat standard_header.txt > ${SOURCE_CONTROL_FILE}
tail --lines $((${LENGTH}-4)) ${SOURCE_FILE} >> ${SOURCE_CONTROL_FILE}
I'm developing an eclipse product and i need to associate a file extension to my editor.
I followed several examples (as like as this and
this) but it seems that the editor ever receives the SWT OpenDocument event.
As described in the fileAssociation example i created an eventListener class to process SWT.OpenDocument events and i added this in my Application class to the display before that the PlatformUI.createAndRunWorkbench() method gets called
public Object start(IApplicationContext context) throws Exception {
Object args = context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
OpenDocumentEventProcessor eProc = new OpenDocumentEventProcessor();
Display display = PlatformUI.createDisplay();
display.addListener(SWT.OpenDocument, eProc);
try{
if(!handleWorkspace(display)){
System.exit(0);
return IApplication.EXIT_OK;
}
int returnCode = PlatformUI.createAndRunWorkbench(display, new XVRWorkbenchAdvisor(args, eProc));
In the product file i added the following program arguments:
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-name
XVR Studio Developer
If I use the same code in a new empty RCP project it works like a charm..
I can't figured out which could be the problem..
can you help me?
Thanks a lot!!
This approach is unknown for me, but since there is no explicit editor call in your pasted code I guess you still rely on eclipse to decide which editor has to be opened. So I guess you still have to define contentypes and file associations declaratively. To do that contribute to "org.eclipse.core.contenttype.contentTypes" extension, add a 'file-association' (file extension...). Get your editor declaration in your plugin xml and add the previously created 'contentTypeBinding' id.
As I have just made this work for an RCP app, I thought it would be helpful to document how I did it here, and provide refs.
I had no use for the 'context.getArguments()..', the 'OpenDocumentEventProcessor' handled everything.
I would suggest that the reason this did not work was that the -name value did not match the value of the 'appName' property in the 'org.eclipse.core.runtime.products' extension point. Just to be sure, I removed the spaces from the appName property and in the -name. Then it worked.
Very useful references are:
For the basic coding:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fproduct_open_file.htm
For an explanation of how this works:
http://aniefer.blogspot.co.uk/2010/05/opening-files-in-eclipse-from-command.html
One small point that eluded me for some time, was getting the path for the file in several chunks at the place where there was a space in the name. Eventually I realised (in a 'duh!' moment) that I needed to put quotes round the %1 parameter in the installer's (InstallAware) definition for the file association - i.e it became "%1"