senseval 2 dataset format - wordnet

I wish to use Senseval-2 Coarse Sense Dataset but there is description available for the same (about the format of the dataset).
It is supposed to have the decision data i.e. whether two senses should be merged or not. Is the middle value a confidence measure? Also, they used a prerelease of Wordnet 1.7. Can I use Wordnet 1.7 for the same?
A sample from the file looks like :
material%5:00:00:physical:00 3 material%5:00:00:worldly:00
material%3:00:03:: 3 material%5:00:00:worldly:00
material%3:00:04:: 2 material%3:00:01::
material%3:00:02::
post%5:00:00:succeeding(a):00
present%3:00:01::
present%3:00:02::
present%3:01:00::
stone%3:01:00::
stone%5:00:00:chromatic:00
air%1:15:00:: 4 air%1:27:00::
air%1:19:00:: 4 air%1:27:00::
air%1:27:01:: 4 air%1:27:00::
air%1:04:00::
air%1:10:02::
air%1:07:00::
air%1:10:01::
appeal%1:04:00:: 3 appeal%1:10:00::
appeal%1:10:02:: 3 appeal%1:10:00::

Through inspection, the middle number actually describes how many senses are in the same merged sense. For example:
matrial%5:00:00:physical:00 3 material%5:00:00:worldly:00
material%3:00:03:: 3 material%5:00:00:worldly:00
basically says that there are 3 senses which is considered the same as material%5:00:00:worldly:00, which are the two senses provided in the two lines, and the sense itself.
You can see also that there are no number for senses that do not get merged, such as air%1:04:00, and for the sense material%3:00:04:: 2 material$2:00:01:: you can see that there are two senses. So you can do the merging by mapping the senses in the first position into the sense in the second position.

Related

Answer Set Programming - make a FACT invalid

I have a question regarding Answer Set Programming on how to make an existing fact invalid, when there is already (also) a default statement present in the Knowledge Base.
For example, there are two persons seby and andy, one of them is able to drive at once. The scenario can be that seby can drive as seen in Line 3 but let's say, after his license is cancelled he cannot drive anymore, hence we now have Lines 4 to 7 and meanwhile andy learnt driving, as seen in Line 7. Line 6 shows only one person can drive at a time, besides showing seby and andy are not the same.
1 person(seby).
2 person(andy).
3 drives(seby).
4 drives(seby) :- person(seby), not ab(d(drives(seby))), not -drives(seby).
5 ab(d(drives(seby))).
6 -drives(P) :- drives(P0), person(P), P0 != P.
7 drives(andy).
In the above program, Lines 3 and 7 contradict with Line 6, and the Clingo solver (which I use) obviously outputs UNSATISFIABLE.
Having said all this, please don't say to delete Line 3 and the problem is solved. The intention behind asking this question is to know whether it is possible now to make Line 3 somehow invalid to let Line 4 do its duty.
However, Line 4 can also be written as:
4 drives(P) :- person(P), not ab(d(drives(P))), not -drives(P).
Thanks a lot in advance.
I do not fully understand the problem. Line 3 and line 4 are separate rules, even if line 4's antecedent is false line 3 would still be true. In other words, line 4 seems redundant.
It seems like you want a choice. I assume ab(d(drives(seby))) denotes that seby has lost their license. So, below line four is your constraint on only people with a license driving. Line five is the choice, so by default andy or seby can drive but not both. Notice in the ground program how line five is equivalent to drives(seby) :- not drives(andy). and drives(andy) :- not drives(seby). You can also have seby as being the preferred driver using optimization statements (the choice rule below is like an optimization statement).
person(seby).
person(andy).
ab(d(drives(seby))).
:- person(P), ab(d(drives(P))), drives(P).
1{drives(P) : person(P)}1.
If something is true, it must always be true. Therefore the line:
drives(seby).
will always be true.
However, we can get around this by putting the fact into a choice rule.
0{drives(seby)}1.
This line says that an answer will have 0 to 1 drives(seby).. This means we can have rules that contradict drives(seby). and the answer will still be satisfiable, but we can also have drives(seby). be true.
Both this program:
0{drives(seby)}1.
drives(seby).
And this program:
0{drives(seby)}1.
:- drives(seby).
Are satisfiable.
Most likely you will want drives(seby). to be true if it can be, and false if it can't be. To accomplish this, we need to force Clingo into making drives(seby). true if it can. We can do this by using an optimization.
A naive way to do this is to count how many drives(seby). exist (either 0 or 1) and maximize the count.
We can count the number of drives(seby). with this line:
sebyCount(N) :- N = #count {drives(seby) : drives(seby)}.
N is equal to the number of drives(seby). in the domain drives(seby).. This will either be 0 or 1.
And then we can maximize the value of N with this statement:
#maximize {N#1 : sebyCount(N)}.
This maximizes the value of N with the priority 1 (the lower the number, the lower the priority) in the domain of sebyCount(N).

Hardware implementation of Data Encryption Standard (S-boxes /permutations)

I am trying to implement the DES circuit and according to a lot of papers, the S-boxes usually is implemented using a SRL or LUT, i'm not familiar with SRL, so i thought i use 8 LUT, each one has 6 adress lines and 4 data lines ( the 1st 2 adress lines represent the 1st and last bits of the bloc, and the 4 other adress lines represent the rest which will define the column)
For example if we take S-box 1 (shown in this figure)
Here is the table that comes with it
That's just for one box, it seems to me wrong, to do all of the boxes we have to write 512 lines. My first question is: is a LUT a hardware component? if so, i am using it correctly? and, is there a more appropriate implementation or representation?
My second question is: what does it mean hardware wiring? I found out that all the permutation function could be implemented using wire crossing, i didn't understand it. Should i make a wire for every bit?

Block types in GNU Radio

I am still learning GNU Radio and I have trouble understanding something about signal processing block type. I understand that if I create a block taking let say 2 samples in the input and output 4 samples, it will be an interpolator of 2.
But now, I would like to create a block which will be a framer. So, it will have two inputs and one output. The block will receives the n samples from the first input, then take m inputs from the second input and append to the samples received from input one, and then output them. In this case, my samples are supposed to be bytes.
How to proceed in this case please ? Am I taking the right path like that? Do any one know to proceed with this type of scenario?
Your case (input 0 and input 1 having different relative rates to the output) is not covered by the sync_block/interpolator/decimator "templates" that GNU Radio has, so you have to use the general block approach.
Assuming you're familiar with gr_modtool¹, you can use it to add things like interpolator (relative rate >1), decimators (<1) and sync (=1) blocks:
-t BLOCK_TYPE, --block-type=BLOCK_TYPE
One of sink, source, sync, decimator, interpolator,
general, tagged_stream, hier, noblock.
But also note the general type. Using that, you can implement a block that doesn't have any restrictions on the relation between in- and output. That means that
you will have to manually consume() items from the inputs, because the number of items you took from the input can no longer be derived by the number of output items, and
you will have to implement a forecast method to tell the GNU Radio scheduler how much items you'll need for a given output.
gr_modtool will give you a stub where you'll only have to add the right code!
¹ if you're not: It's introduced in the GNU Radio Guided Tutorials, part 3 or so, somethig that I think will be a quick and fun read to you.
Considering that the question was asked 4 years ago and that there has been many changes in GNU Radio since then, I want to add to the answer that now this is possible to do with the Patterned Interleaver block.
patterned_interleaver_image
This block works the following way: it receives inputs in the ports to the left and outputs a single interleaved pattern in the port that is to the right. So let's imagine a block with 2 inputs, V1 and V2:
V1 = [0,1,0,0,1,1]
V2 = [1,1,1,0,1,0]
Suppose we want the output to be the first 2 bits of V1 followed by the first 2 bits of V2 followed by the next 2 bits of V1 and then the next 2 bits of V2 and so on...that is, we want the output to be
Vo = [0,1,1,1,0,0,1,0,1,1,1,0].
In order to accomplish this we go to the properties of the Patterned Interleaver block which looks like this:
patterned_interleaver_properties
The Pattern field allows us to control the order in which the bits in the input ports will be interleaved. By default they are in [0,0,1,1] meaning that the block will take 2 bits from input port 0 followed by 2 bits from input port 1. The corresponding output will be
[0,1,1,1,0,0,1,0,1,1,1,0],
that is, the first 2 bits of V1 followed by the first 2 bits of V2 and then the next 2 bits of V1, etc.
Let's see another example. In case the Pattern field is set to [0,0,1,1,1,0] the output will be 2 bits from input port 0 followed by 3 bits from input port 1 and then 1 bit from input port 0. In the output we will obtain [0,1,1,1,1,0,0,1,0,1,0,0].
Lastly, the Pattern field is also used to determine the number of input ports. If the Pattern field is [0,0,1,2] we will see that another input port is added to the block.
patterned_interleaver_3_inputs

Understanding Google Code Jam 2013 - X Marks the Spot

I was trying to solve Google Code Jam problems and there is one of them that I don't understand. Here is the question (World Finals 2013 - problem C): https://code.google.com/codejam/contest/2437491/dashboard#s=p2&a=2
And here follows the problem analysis: https://code.google.com/codejam/contest/2437491/dashboard#s=a&a=2
I don't understand why we can use binary search. In order to use binary search the elements have to be sorted. In order words: for a given element e, we can't have any element less than e at its right side. But that is not the case in this problem. Let me give you an example:
Suppose we do what the analysis tells us to do: we start with a left bound angle of 90° and a right bound angle of 0°. Our first search will be at angle of 45°. Suppose we find that, for this angle, X < N. In this case, the analysis tells us to make our left bound 45°. At this point, we can have discarded a viable solution (at, let's say, 75°) and at the same time there can be no more solutions between 0° and 45°, leading us to say that there's no solution (wrongly).
I don't think Google's solution is wrong =P. But I can't figure out why we can use a binary search in this case. Anyone knows?
I don't understand why we can use binary search. In order to use
binary search the elements have to be sorted. In order words: for a
given element e, we can't have any element less than e at its right
side. But that is not the case in this problem.
A binary search works in this case because:
the values vary by at most 1
we only need to find one solution, not all of them
the first and last value straddle the desired value (X .. N .. 2N-X)
I don't quite follow your counter-example, but here's an example of a binary search on a sequence with the above constraints. Looking for 3:
1 2 1 1 2 3 2 3 4 5 4 4 3 3 4 5 4 4
[ ]
[ ]
[ ]
[ ]
*
I have read the problem and in the meantime thought about the solution. When I read the solution I have seen that they have mostly done the same as I would have, however, I did not thought about some minor optimizations they were using, as I was still digesting the task.
Solution:
Step1: They choose a median so that each of the line splits the set into half, therefore there will be two provinces having x mines, while the other two provinces will have N - x mines, respectively, because the two lines each split the set into half and
2 * x + 2 * (2 * N - x) = 2 * x + 4 * N - 2 * x = 4 * N.
If x = N, then we were lucky and accidentally found a solution.
Step2: They are taking advantage of the "fact" that no three lines are collinear. I believe they are wrong, as the task did not tell us this is the case and they have taken advantage of this "fact", because they assumed that the task is solvable, however, in the task they were clearly asking us to tell them if the task is impossible with the current input. I believe this part is smelly. However, the task is not necessarily solvable, not to mention the fact that there might be a solution even for the case when three mines are collinear.
Thus, somewhere in between X had to be exactly equal to N!
Not true either, as they have stated in the task that
You should output IMPOSSIBLE instead if there is no good placement of
borders.
Step 3: They are still using the "fact" described as un-true in the previous step.
So let us close the book and think ourselves. Their solution is not bad, but they assume something which is not necessarily true. I believe them that all their inputs contained mines corresponding to their assumption, but this is not necessarily the case, as the task did not clearly state this and I can easily create a solvable input having three collinear mines.
Their idea for median choice is correct, so we must follow this procedure, the problem gets more complicated if we do not do this step. Now, we could search for a solution by modifying the angle until we find a solution or reach the border of the period (this was my idea initially). However, we know which provinces have too much mines and which provinces do not have enough mines. Also, we know that the period is pi/2 or, in other terms 90 degrees, because if we move alpha by pi/2 into either positive (counter-clockwise) or negative (clockwise) direction, then we have the same problem, but each child gets a different province, which is irrelevant from our point of view, they will still be rivals, I guess, but this does not concern us.
Now, we try and see what happens if we rotate the lines by pi/4. We will see that some mines might have changed borders. We have either not reached a solution yet, or have gone too far and poor provinces became rich and rich provinces became poor. In either case we know in which half the solution should be, so we rotate back/forward by pi/8. Then, with the same logic, by pi/16, until we have found a solution or there is no solution.
Back to the question, we cannot arrive into the situation described by you, because if there was a valid solution at 75 degrees, then we would see that we have not rotated the lines enough by rotating only 45 degrees, because then based on the number of mines which have changed borders we would be able to determine the right angle-interval. Remember, that we have two rich provinces and two poor provinces. Each rich provinces have two poor bordering provinces and vice-versa. So, the poor provinces should gain mines and the rich provinces should lose mines. If, when rotating by 45 degrees we see that the poor provinces did not get enough mines, then we will choose to rotate more until we see they have gained enough mines. If they have gained too many mines, then we change direction.

Are my container's children starting at index -1 or 0?

I'm getting some behavior with a container object's children I just don't understand.
I'm making four display objects children of an mx:Canvas object. When I call getChildren(), I see them all in order, right where I think they should be:
1
2
3
4
The fun begins when I call swapChildrenAt(0,1); that's supposed to swap the positions of 1 and 2, but instead I wind up with:
MYSTERY_OBJECT_OF_MYSTERY
2
3
4
So, where did 1 go? Why, it's at position -1, of course.
getChildAt(-1): 1
getChildAt(0): MYSTERY_OBJECT_OF_MYSTERY
getChildAt(1): 2
getChildAt(2): 3
getChildAt(3): 4
FWIW, MYSTERY_OBJECT_OF_MYSTERY is a 'border'. Don't know how it got there.
Regardless, I find it baffling that getChildAt() and swapChildrenAt() are apparently using different starting indexes. Can anybody shed some light on this behavior?
You appear to be swapping the index of the display Objects instead of passing the display Objects at those location themselves.
The official documentation says
"swapChildren(child1:DisplayObject, child2:DisplayObject):void" therefore the index of the Display Objects themselves cant be used.
I hope this solves your problem.