I am using gate 7.1. in that i have 30 .def files are loading every time.
I have run multiple text files every time all 30 .def files loading if any possibility to load all 30 .def files into single object and send that object to gazetteer.
add multiple def files at a time to anniecontroller
Vijay,
I do not believe it is possible to load def files within a single def file.
The Definition (or Index) file specifically references a list (lst) file. List files reference terms, majorType, minorType, language, and the list display name.
For example:
testList:majorType=Major Type:minorType=Minor Type
The resulting .def would look like:
testList.lst:Major Type:Minor Type:English: Test List
The definition file can only contain list file references. That being said, You can alter the structure of the definition file to meet your needs. There are several different way to do this, all permutations of the same concept.
Add all lists under one def file with each list having a different label,
Build a small set of def files with related lists,
Build a larger set of def files that evolve from other lists.
Question is, what are you trying to do?
Yes , It is possible to load multiple def files . You can do it by using annie plugin .So , First you have to load that plugin from CREOLE option.Select ANNIE from it .
After that, you can select Annie Gazetteer as a processing resource. Then their, you can add multiple def files paths, where you just need to give the paths of def files.
Related
I'm trying to use python-fu in GIMP. I would like pdb.file_glob to return an array of image files in the format I specify. I tried:
myGlob = "*.png|*.PNG|*.jpg|*.JPG|*.gif|*.GIF|*.xcf|*.XCF"
globpath = os.path.join(patternDir, myGlob)
num_files, files = pdb.file_glob(globpath, 0)
But the files array is always empty, I assume because the glob syntax is invalid.
Note that if I use myGlob="*", I get the graphics files I want, but I also get files such as "fake.txt", which I want to exclude.
The doc of all PDB functions can be found via the Python-fu console. Hit the Browse... button and then enter your search in the filter bar at the top of the left pane. This documentation is dynamic, it includes the documentation of any callable plugin/script (as long as authors have written some of course)
The PDB functions for Python are a direct mapping of the script-fu API. In this specific case file_glob() was very recently added to the script-fu API because there is nothing in the base TinyScheme language to do it. In Python, you are better off using the standard Python API, os.walk() or glob.glob()/glob.iglob().
In any case such functions only do simple pattern matching, if you want several extensions you want something like this:
sorted([filename for ext in ['XCF','xcf','jpg','JPG','jpeg','gif','GIF'] for filename in glob.glob('*.'+ext)])
Edit: this is a "comprehension", more or less a loop with the inner instruction outside. You can read it as:
files=[]
for ext in ['XCF','xcf','jpg','JPG','jpeg','gif','GIF']:
for filename in glob.glob('*.'+ext):
list.append(filename)
For certain project I want to make statistics like list of public methods and functions. Great option might be using CppDepend and it's build-in query language.
Our (legacy) project base has applications. Each application is in it's own directory, has project file and some subdirectories with sources. Certain subdirectories are shared in multiple applications (using svn:externals). My goal is count methods and functions in such shared directories only once.
For example if file my_file.h contains three functions and is checked out to three different local directories I still want to add only 3 to my statistic and not 9.
Is there a way to tell cpp what directories/files are checked out to multiple local directories to count them only once?
To avoid counting the same methods you can add the distinct filter to the cqlinq query like this:
from m in JustMyCode.Methods.Distinct(m=>m.FullName)
select m
So each method will be counted once, or you can improve the query to avoid filtering methods with the same signature but are not the same by adding a filter of the source file name
from m in JustMyCode.Methods.Distinct(m=>new {m.FullName,m.SourceDecl.SourceFile.FileName})
select m
I'm using Knime 3.1.2 on OSX and Linux for OPENMS analysis (Mass Spectrometry).
Currently, it uses static filename.mzML files manually put in a directory. It usually has more than one file pressed in at a time ('Input FileS' module not 'Input File' module) using a ZipLoopStart.
I want these files to be downloaded dynamically and then pressed into the workflow...but I'm not sure the best way to do that.
Currently, I have a Python script that downloads .gz files (from AWS S3) and then unzips them. I already have variations that can unzip the files into memory using StringIO (and maybe pass them into the workflow from there as data??).
It can also download them to a directory...which maybe can them be used as the source? But I don't know how to tell the ZipLoop to wait and check the directory after the python script is run.
I also could have the python script run as a separate entity (outside of knime) and then, once the directory is populated, call knime...HOWEVER there will always be a different number of files (maybe 1, maybe three)...and I don't know how to make the 'Input Files' knime node to handle an unknown number of input files.
I hope this makes sense.
Thanks!
Thanks to Gábor for getting me on the right track. Although I ended up doing a slightly different route after much experimentation.
===
Being new to Knime, I don't know if this is an efficient use of Knime, or a complete Kluge...but it does work.
So, part of the problem is some of the Knime specific objects - One of which is called URIDataValue.
A Python Pandas dataframe is, apparently, interchangable with the Knime tables. However, I don't know if there's a way to import one of these URIDataValue objects into Python. So here's what I did...
1. I wrote a Python script that creates a Pandas Dataframe, and populates it with one Column. Everything is a string, including the column header:
from pandas import DataFrame
# Create empty table
T = DataFrame(
[
['file:///Users/.../copy/lfq_spikein_dilution_1.mzML'],
['file:///Users/.../copy/lfq_spikein_dilution_2.mzML'],
],
)
T.columns = ['URIDataValue']
#print T
output_table = T
That creates this dataframe:
Note: The column name and values are just strings. But it is (apparently) important that the column header be 'URIDataValue'...even though HERE it's just text. If the column name is not 'URIDataValue' the next node doesn't know what to do.
NEXT, the 'output_table' from the 'Python Source' node is patched to a 'String to URI' node, which (apparently and magically) knows to change the entire columns string values to URIDataValues (presumably based on the name of the first column...don't know that for sure).
Finally, the NEW table, with the correct data objects goes to a 'URI to PORT' node...since apparently 'Port' objects and a 'URI' object are different.
This, then, matches the needed input to the ZipLoop...which is normally the out put from a static (hard coded) 'Input Files' node.
Now, to actually solve the question above, I just have to add the code to my 'Python Source' to download and unzip the S3 files, then annotate the dataframe with their locations, and go.
I have no idea what I'm doing, but it worked.
There are multiple options to let things work:
Convert the files in-memory to a Binary Object cells using Python, later you can use that in KNIME. (This one, I am not sure is supported, but as I remember it was demoed in one of the last KNIME gatherings.)
Save the files to a temporary folder (Create Temp Dir) using Python and connect the Pyhon node using a flow variable connection to a file reader node in KNIME (which should work in a loop: List Files, check the Iterate List of Files metanode).
Maybe there is already S3 Remote File Handling support in KNIME, so you can do the downloading, unzipping within KNIME. (Not that I know of, but it would be nice.)
I would go with option 2, but I am not so familiar with Python, so for you, probably option 1 is the best. (In case option 3 is supported, that is the best in my opinion.)
I have a tons of files and I want to convert them to other format using command prompt.
After exporting each of converted files program needs to name it.
I have a txt-documnet, that contains a list of future file-names.
So, I really need to name exported files one by one using first string name, then second string name, then third and so on.
EXAMPLE I have files to import in the directory
00001.umg
00002.umg
00003.umg
00004.umg
00005.umg
00006.umg
00007.umg
(and so on)
I have a txt document looking like this
Great name.brt
Wonderful.brt
Most beautiful.brt
Beautiful File.brt
Random File.brt
Define.brt
Excellent file.brt
...
(and so on)
So, after convertion I need to have exported files named like string in txt document in proper direction. First file must take first TXT string name, second - second string.....
Thank you!
I need to remove the first 4 characters of the names of over 100 files in a certain directory, can I do this with an obj-c program or a c ++ program and if so how?
Yes you can.
The NSFileManager class provides all the methods you need.
To get the contents of the directory use the contentsOfDirectoryAtPath method.
To rename the file you need to use the moveItemAtPath method.
Take a look at the class reference https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
Steps:
1. Get the names of the files in the dir.
2. Iterate all the files and use the moveItemAtPath to rename.