openNLPmodels.en error while trying to extract entity in text analysis - opennlp

I am using R3.1.2 for text analysis to extract entity(kind=person). i have loaded openNLP and openNLPmodels.en from http://datacube.wu.ac.at. but i get the following error.
Error in Maxent_Simple_Entity_Detector(language, kind, probs, model) :
Could not find model file for language 'en' and kind 'person'.
Apparently, package 'openNLPmodels.en' is installed
but does not provide this model.
What is the resolution?
Thanks
Sridevi

Let me provide the exact steps that worked for me. These steps assume you already have have OpenNLP, rJava libraries working.
Install openNLPmodels.en
install.packages("openNLPmodels.en", dependencies=TRUE, repos = "http://datacube.wu.ac.at/")
Navigate to the openNLPmodels.en library folder. For me, this was \filesrv\users\MYNAME\My Documents\R\win-library\3.4\openNLPmodels.en
Create a new folder within openNLPmodels.en called models
Visit the openNLP models page on sourceforge and download
two files: en-chunker.bin and en-ner-person.bin
Place those files in your models folder.

Install the openNLPmodels.en from http://datacube.wu.ac.at/src/contrib/. This package is no more available on CRAN. So, download is offline and install it on your R/Rstudio. It is working for me. ! Hurray !

I had the same issue and was able to resolve it installing the additional packages "RWeka" and "qdap". Additionally, ensure you have 'rJava' installed. In short, run the following and see if, after requiring the packages, you are able to run your code.
install.packages(c("NLP", "openNLP", "RWeka", "qdap", "rJava"))

as you have probably installed openNLPmodels.en and its loading properly. I went into the source code of parse.R of openNLP and found something like this
package <- "openNLPmodels.en"
model <- system.file("models/en-parser-chunking.bin",
package = package) .
Points to be noted ..
1) I am on a Linux machine with R version of 3.3.2. and
2) have installed version of openNLPmodels.en form
https://cran.r-project.org/src/contrib/Archive/openNLPmodels.en/ . to my surprise i didn't find "models/en-parser-chunking.bin" in its path.so i have downloaded the corresponding parser file. from http://opennlp.sourceforge.net/models-1.5/ and placed it in the folder called models. and was able to get it working.
parse_annotator <- Parse_Annotator()
## Compute the parse annotations only.
p <- parse_annotator(s, a2)
now this code worked for me.
Prior to this i as having similar error with.
annotate(s, Maxent_Chunk_Annotator(), a3)
#Error in Maxent_Simple_Chunker(language, probs, model) :
Could not find model file for language 'en'.
Apparently, package 'openNLPmodels.en' is installed
Now Guess what, i have given the path to model (chunker.bin file) in Maxent_Simple_Chunker and was able to get it work.
apologize for my poor formatting skills
all the parse and chunker code i used can be found in the documentation.if you want to reproduce the examples

Related

Can not find northconcepts.datapipeline.jar

I am junior java developer and I am trying to test a data pipeline project given in this link
> https://northconcepts.com/docs/examples/read-a-csv-file/
in my local machine.
I get many errors that are generated such as :
Description Resource Path Location Type The import
com.northconcepts.datapipeline.core.DataEndpoint cannot be
resolved ReadCsvFile.java /ReadCSVFile/src/PipelineCSV line 6 Java
Problem
So, I think that I need to import jar files which are related to the imported libraries given in the code.
The problem is that I can not find online any jar file related to the northconcepts.datapipeline libraries to download and work with!
Any help, please ?
The library is available here but you need to register to download it (and pay for it, if you want something other than the free express version).
You can test the code by following the getting started guide below to configure Maven/Gradle and get a license. It should be pretty quick.
https://northconcepts.com/docs/user-guide/#getting-started
The examples are also on GitHub.

How to create distribution of Python GTK3 app?

I made an application using GTK3 on Windows (Mingw_x64 installation of GTK) and I cannot really figure out how to make a distribution out of this. According to official documentation of PyGObject, it is possible in some way.
I already tried to make a package using setuptools, but PyGObject documentation is not saying much about this process and I was not able to configure setup correctly to make it work. PyGObject has a lot of dependecies and weird imports, that I do not know how to include.
I also tried Pyinstaller, which claims it has GTK support, and it really can pack it into executable, however it is not working. I tried these two options:
make only one file (.exe), but in this situations, it throws an error, that some file is not found (libpixbufloader-ani.dll)
create a directory with all needed files (libpixbufloader-ani.dll and other libs are included this time), but when running exe, another exeption occurs, this time Struct and 2 other libraries are missing (strangely, there is a folder that contains Struct)
Becouse of the missing files, I tried adding as many paths containing needed libraries as possible to Pyinstaller, but without success.
Does anyone have any experience with packaging GTK appliciations in Python? There is definitely a way to do this, but I am not very experienced with packaging. If needed, I can provide more information.
This is an issue that has been brought up on PyInstaller's GitHub page, as others (including myself) have experienced the same issue that you've mentioned.
The last time I tried the dev version of PyInstaller, the issue still wasn't fixed, but I managed to get a working executable by using PyInstaller to find the dependencies that my Python3/GTK3 app needed, and then I used cx_Freeze to generate the final executable.

Visual studio complains about spatial types

I have these CLR types installed on my local https://puu.sh/yEWG5/b4f77fba7b.png
Also, I have SQL server 2016 installed on my local system but when I try to run the project I get error as below
https://puu.sh/yEWQm/78a4220830.png
Can someone help? I tried installing latest nugget package from https://www.nuget.org/packages/Microsoft.SqlServer.Types/ but it did not help.
Though I am able to add a column of type geography in a table in my local database. It fails at runtime when I run my project and error comes as below
https://puu.sh/yEWQm/78a4220830.png
According to the docs if you have installed the CLR Types it should load from the GAC so I'm not sure why that didn't work for you. (I would check that you have the correct version as your dependency)
However, we do use the SQLServerTypes in our app without installing the CLR types by using the following method (this method is described in the readme.htm that comes with SqlServerTypes).
Grab the SqlServerTypes.nupkg and extract it to a folder lets call this folder SST from now on.
(Locations of the files I talk about in the following steps may differ from version to version but, the principle is the same)
Create a SqlServerTypes folder in your project
Copy the SST/nativebinaries/x86 and x64 folders into your new SqlServerTypes folder
Also copy the files from SST/content (you should see Loader.cs and readme.htm) into the SqlServerTypes folder.
Now all you need to do is call the Loader when your app boots up.
We do this during our autofac setup by making this call.
Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory)
You may need to adjust the param passed into this method to work with your application. If the correct path is used you should have access to the spatial types in your code.
edit: It may be possible to just call the LoadNativeAssemblies straight away (and avoid all the work I posted above) if you have installed the nuget package in your app but, I have not tested this as we are stuck on an old version of SqlServerTypes.
Because i cannot put a comment i have to put a answer, you can check that, that article and this, this, this and this answers, i hope they guide you to someting usefull.

How to install wxPython for Python 3.3?

I need wxPython for a project I'm currently writing. It's a basic text editor- it'll eventually have markdown and bbcode editing supported (with error checking), but right now I want to get the program working. The guide I'm using uses wxPython, but it's official support is only up to 2.5. I'm using Python 3.3, and I grabbed one of the development builds.
I just don't know how to install it, but I found this comment, but I'm not sure what it's telling me to do. Is it telling me to create a folder in one of python's subfolders, then use the bit of code in every wx program I make? Or is it telling me something else?
Edit: I found the site-packages folder and made the folder, then pasted the appropriate folder in the folder I made, but it threw the error :
ImportError: No module named 'wxversion'
Using Ninja IDE 2.2, if it helps at all.
Edit 2: So I wx instead of wxversion, and it seemed to work, but now Ninja IDE pulls up core.py and tells me
ImportError: DLL load failed: %1 is not a valid Win32 application.
Does anyone know what this means, and how I can fix it?
If you don't have another version of wxPython installed then you don't have any need to use wxversion. Just put Phoenix's wx package folder directly in site-packages and use it normally.

RQuantlib and Mac OS X 10.8.2

I'm a total newbie in Mac OS X, R and C++. Sound like a good mix, doesn't it?
I have the need to use RQuantLib, because I want to use some pricing functions part of the QuantLib package inside R, all on a Mac OS X-powered environment.
I've correctly installed QuantLib. I've already asked to the official QuantLib mailing list, and together we seem to have reached the conclusion that the problems I'm encountering are not related to my QuantLib installation, which seems ok and correctly configured.
So, I turned to R to try and solve the problem. Whenever I try to run ZeroCouponBond from within R, copying and pasting the first example provided with the official documentation, I get the following error:
"Error in DiscountCurve.default(discountCurve.param, list(flat = 0.05)) :
cannot find function errorOccured"
Now, I would rule any syntax.related problem out, since I'm copying the very same example present in the official help.
I don't know what I did wrong, but I know I need to find a solution at all costs. I've installed Rcpp, and the configuration seems really ok. Just one question I was not able to find an answert to: in my understanding, RQuantLib basically acts as a link between QuantLib and R. If that's correct, how can I tell RQuantLib where to look to find libQuantLib.a, that is, the compiled library resulting from the "make && sudo make install" commands performed while installing QuantLib itself?
Right, so, I've finally managed to get it to work.
First of all, I would like to say that things would have been much easier if a thorough, step-by-step installation procedure had been provided. I acknowledge I'm a total newbie, but I think other people approaching to R for the first time might encounter difficulties similar to those I had to overcome.
Anyway, this is what I did:
I've downloaded the .tar.gz source packages for both Rcpp and RQuantLib from cran.r-project.org
I've compiled them installing them from within the R environment. This is where I was making a mistake. Indeed, I was trying to compile them by invoking the configure installation script from the terminal; however, as Dirk said, the config script looks for QuantLib's quantlib-config script, and I didn't know the correct syntax to tell the configure script the correct path to QuantLib. Executing the procedure from R (by just installing the package) sorts out any problem, as all the dependencies are correctly located and loaded
So, that's pretty much it: just install the .tar.gz source package as you would do with the binary version, and everything should work ok.
Of course, I'm still curious to understand:
If it is possible to compile Rcpp and RQuantLib from the terminal; and
Why the binary version for Mac OS X will not work on my system, ie: why do I have to compile starting from the source code?
Thank you so much to anyone willing to answer my (probably naive and silly) questions. I'm eager to understand a bit more!
Thanks!
The RQuantLib package uses a tool called configure which determines the patch at package build-time. It looks for the script quantlib-config from which it learns about the location of libQuantLib.a.
First, install boost (brew install boost) and, secondly, Quantlib (currently at 1.7.1) by following instructions at http://quantlib.org/install/macosx.shtml:
cd QuantLib-1.x.y
./configure --enable-static --with-boost-include=/opt/local/include/ \
--with-boost-lib=/opt/local/lib/ --prefix=/opt/local/
make && sudo make install
It takes some time (~1 hour) for make.
Then in R or Rstudio, install packages Rcpp and RQuantlib. The later requires type="source" since only source package is available.
At this point, you should be able to use RQuantlib. The American Option value (SPY as of 4/1/2016, maturity 7/15/2016) can be calculated in R as
AmericanOption("put", strike=206, volatility=0.1525, underlying = 206.92, 0.021, 0.003, 73/252, engine="CrankNicolson")

Resources