Random queries of grammar generated using PLY - random

I have created a grammar using PLY and I would like to generate some random queries that follow this grammar. Is there any way of doing this? I could't find anything in this matter only for context free grammars.
Thanks in advance.

Related

pyhf: POI application using formula

I am trying to write a likelihood model in which the POI affects two samples, but while one I have the regular POI*yield, the other I have f(POI)*yield where f is an arbitrary function.
Is there a simple way to implement that in pyhf?
Thanks in advance.
pyhf currently does not support it, but it's something that is on our mind. Can you open an issue on our github with this as a feature request and we can work out how to do it.

Any hints on how to train a nn dependency parser on a new corpus?

We'd like to train the Stanford NN dependency parser on a Russian corpus, are there any hints on how to do it? The hyper-parameters are described in the paper, however it would be nice to understand how to prepare the training data (Annotations, and specifically how to create word2vec annotations). Any help or a reference to some document is greatly appreciated!
Thanks!
Here are some answers:
the site for word2vec if you want to build vector representations for Russian:
https://code.google.com/p/word2vec/
the dependencies need to be in the CoNLL-X format:
http://ilk.uvt.nl/conll/#dataformat
The word embeddings should be in this format (each word vector on its own line):
WORD\tn0 n1 n2 n3 n4 ...
for instance:
apple .45242 .392323 .111423 .999334
put your embeddings in a file called russian_embeddings.txt
the training command (assumes your word vectors have dimension=50)
java edu.stanford.nlp.parser.nndep.DependencyParser -tlp edu.stanford.nlp.trees.international.RussianTreebankLanguagePack -trainFile russian/train.conll -devFile russian/dev.conll -embedFile russian_embeddings.txt -embeddingSize 50 -model nndep.russian.model.txt.gz
A big complication is that as of the moment, edu.stanford.nlp.trees.international.RussianTreebankLanguagePack does not exist, so you will have to create this class and model it after the TreebankLanguagePacks for other languages ; if you look around in the package edu.stanford.nlp.trees.international , you can see what these TreebankLanguagePack files look like for other languages (note: the French one is only 143 lines long, so making a similar class for Russian is not out of the question at all) ; I will consult with other group members and see if I can get some clarity on what you'd have to do to complete this task
There are a lot of challenges to building this Russian NN dependency parse model. If you would like more help please let me know. I will talk to the developers of the NN parser and see if I can give you more advice, these answers are meant as a starting point!

sentiWordNet in rapidminer

I am trying to integrate SentiWordNet into Rapidminer using the Extract Sentiment operator. I cannot find a way to get the dictionary input, in fact even if I use the OpenWordnetDictionary operator I get "Map failed" error.
Has anyone of you ever (successfully) performed the same operation or know how I can make it work?
Thank you
There are some examples here. The basic trick is to put the Sentiword text file into the same folder as the Wordnet dictionary.

Beginner Scheme: How to write string-downcase

I was just wondering while reading my textbook how someone could write string-downcase for beginners in scheme? Thank so much!
I know how to do it using map but I was wondering if there was a more basic way to do it so that beginners to scheme can understand without knowing what map does. Thanks!
This time I'll write the general idea of the algorithm, you should know by now how to write this up using a template:
Transform the string to a list of characters, using string->list
Iterate over the list, and transform each character to lowercase using char-downcase
Build a new list with the newly transformed characters
Finally, transform back the resulting list using list->string
Basically we're mapping over the characters in the string. There are several fancy ways to do this, for instance using sequences, or map, etc. but for now, I believe is better that we stick to the basics and learn how to do this from scratch.

Creating Code from sequence diagram

Is there a way to Generate Code from sequence diagram ?? All I could find is Reverse Engineeering ie..from the generated code you can obtain sequence diagram.
Is there a way to do otherway round (From the diagram to source code generation). This is already acheived for UML class diagrams.
link for the same http://msdn.microsoft.com/en-us/library/ff657795.aspx i want the same thing for sequence diagram.
Is there any third party tools generating the code from the UML Sequence diagram?? would like to know more about it..??
[And the language which i'm using for code generation is CSharp]
Can anyone please help me??
any help would be greatly appreciated..:):)
Thanks in advance:):)
Recently I was also looking for something similar and came to find this. StarUML also has Various Language Support (C# Profile, Code Generator and Reverse Engineer) according to their website. Although personally I haven't used any of them and have decided not to use any automatic code generator, you may try them.

Resources