Monday, April 7, 2014

World Cup T20 14 Final Post Mortem

I am also one of the millions of ardent fans of Indian Men's cricket. And yes it was very disappointing to see India lose the finals. It's not like the team crumbed under pressure (remember WC 2003 Final); but the team was out-witted by some perfect execution of skills by the hungry Sri Lankan side. It doesnt mean that we should question the hunger of the Indian side, I didnt mean that.

Since last 24 hours I have seen a lot of posts, jokes, memes targeting a single player Yuvraj for the team's loss. I understand that the fans get emotional about cricket in our country but I wanted to shed some light on the actual statistics.

Last 4 overs analysis.
Kohli 7 in 8b (S/r 87.50)
Yuvraj 4 in 9b (S/r 44.44)
Dhoni 4 in 7b (S/r 57.14)
Ext 4

True it was disappointing and frustrating to see the Indian team getting strangled; but we should not target Yuvraj. Sri Lankans executed their plans perfectly. Give credit to them.

Also, one other observation is - Sri Lankans added one more left hander to their squad, strengthening their batting and also to mitigate the impact of mishra and jadeja in the game. [both turn the ball into the left-handers making it easy to slog]. I think we missed a trick in our bowling combination. But all credit should go to the Sri Lankan think-tank, again. Stop taking out the frustration on Indian players. 

This team can only spiral upwards. In the form of Kohli we seem to have a strong candidate for heir-apparent of Dhoni. At the same time Rohit sharma also seems to be gaining the confidence to perform consistently at the international level under the shadow of Kohli's performances. These are encouraging signs for Indian cricket. I get a feeling that this defeat will make the Indian team and Yuvraj singh hungrier and give them one more reason to prove the critics wrong at the WC 2015. Fingers crossed!, as always an optimistic Indian cricket fan.




Friday, April 4, 2014

Finding head word in a Noun Phrase

Recently I came across this problem of finding head words in phrases. This problem assumes significance in a coreference resolution setup. (More on coreference resolution in another post). I was trying to do a simple string match on two phrases after stripping each of the phrases off closed-class words (or stopwords) and punctuation marks. Upon analyzing the results I realized that a simple string match may not solve the problem.

For example: matching "a glass bowl" and "glass of milk"

If we follow the heuristic of matching them after stripping them off stopwords and punctuation marks, we would end up saying that both the phrases are a match. (as there is a string match of "glass").

That is when I realized the need for identifying the entity being talked about in a phrase. The head words for the 2 phrases listed above are "bowl" and "milk" respectively.

It turns out that in NLP literature, it is called as the head word. Prof. Michael Collins, around 19992, seems to have come up with some heuristics (rules based on syntax tree path etc..,) to identify these head words. Upon further research, it seems to me that this is the state of the art and the heuristics are implemented in the stanford CoreNLP suite1

Here is a sample code below based on Stanford CoreNLP to identify head words for NounPhrases3:

1:  public static void dfs(Tree node, Tree parent, HeadFinder headFinder) {  
2:    if (node == null || node.isLeaf()) {  
3:     return;  
4:    }  
5:    if(node.value().equals("NP") ) {  
6:     System.out.println(" Noun Phrase is ");  
7:     List<Tree> leaves = node.getLeaves();  
8:     for(Tree leaf : leaves) {  
9:      System.out.print(leaf.toString()+" ");  
10:    }  
11:    System.out.println();  
12:    System.out.println(" Head string is ");  
13:    System.out.println(node.headTerminal(headFinder, parent));  
14:   }  
15:   for(Tree child : node.children()) {  
16:    dfs(child, node, headFinder);  
17:   }  
18: }  

References:
[1] http://nlp.stanford.edu/software/corenlp.shtml
[2] Prof Michael Collins' thesis has description about head finding rules here http://www.cs.columbia.edu/~mcollins/publications.html
[3] More details on StanfordCoreNLP HeadFinders here - http://stackoverflow.com/a/22841952/1019673