Marking categories and attributes [closed] - pivot-table

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I have an OpenOffice spreadsheet that has several categories (different kinds of meat and vegetables, for example) and for each of them, it lists the spices that go well with it (thyme, garlic, etc).
Is there a way to make a table/spreadsheet, that has the categories as one axis and the spices as the other, and marks the matches with an X or a colored cell?
A bit like this:
I have:
Pork Garlic Parsley Chive
Beef Garlic Thyme Sage
Cauliflower Curry Thyme
Tomato Garlic Curry Sage
I would like to have:
Garlic Curry Parsley Chive Thyme Sage
Pork X X X
Beef X X X
Cauliflower X X
Tomato X X X
I really do have a list of spices and food, inspired by this Infographic. I expanded a lot upon it with other sources, and now I want to be able to see my data a bit better.

You can do something like this using the Pivot Table functionality (in LibreOffice Calc: Menu Data -> Pivot Table -> Create...). In Apache OpenOffice Calc, this feature is named Data Pilot. In your use case, you will have to normalize the raw data before you can create a pivot table (AFAIK). So, if your raw data would look like this:
Categories Spice
Pork Garlic
Pork Parsley
Pork Chive
Beef Garlic
Beef Thyme
Beef Sage
Cauliflower Curry
Cauliflower Thyme
Tomato Garlic
Tomato Curry
Tomato Sage
you can easily create a pivot table looking like this:
To adapt the layout, just use the conditional formatting tools (this allows for replacing the count 1 by an X and applying background colors). The pivot table definition simply looks as follows:

Related

How to formulate the LP problem and solve it in CPLEX using a set (ranges) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
Exercise question:
Resource data table:
The Dakota Furniture Company manufactures desks, tables, and chairs. The manufacture of each type of furniture requires lumber and two types of skilled labor: finishing and carpentry.
The amount of each resource needed to make each type of furniture is given in Table 2.
Currently, 48 board feet of lumber, 20 finishing hours, and 8 carpentry hours are available.
A desk sells for $60, a table for $30, and a chair for $20.
Dakota believes that demand for desks and chairs is unlimited, but at most five tables can be sold.
Because the available resources have already been purchased, Dakota wants to maximize total revenue
My current code:
MAX OBJECTIVE VALUE Z SHOULD BE 280 WITH x1=2, x2=0, x3=8
BUT I AM GETTING Z = 180.
What is this supposed to mean:
forall (i in I, j in J)
sum(j in J) x[i][j] <= S[i];
Similar for the other constraints.
You may want to generate an LP file to see what OPL is actually generating. It is likely different from what you think.
OPL should really not accept this kind of input.

Custom training Extract PDF into table [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I have a PDF file that includes a table and I want to convert it into table structured data.
My PDF file includes a pretty complex table which makes most tool insufficient. For example,
I tried to use the following tools and they didn't extract it well: AWS Textract, Google AI Document, Google Vision, Microsoft Text Recognition.
Actually, Google AI Document managed to do about 70% correct but it is not good enough.
So, I searched for a way to customize train model, so that when extracting this table, it will extract it properly. I tried Power Apps AI Builder and Google AutoML Entity Extraction, but both of them didn't help (BTW, I wasn't what AutoML's purpose, is it for prediction or also possible to customize table extraction?).
I would like to know which tools are good for my use case and if there is any (AI) tool that I can use to train these kind of tables, so that the text extraction will be better.
Most text extractors should hold that structure if it is rendered crisp enough, but layout can be many a fickle mis-trees.
Here it correctly picked up the mis-spelling of reaar but failed in first line on 05.05.1983
On an identical secondpass the failings are different
3 29.06.1983 Part of Ground Floor of 05.05.1983 GM315727
2 (part of) Conavon Court 25 years from
1.3.1983
4 31.01.1984 Part of Third Floor Conavon 30.12.1983 GM335793
4 (part of) Court 25 years from
12.8.1983
5 19.04.1984 I?art of Basement Floor of 23.01.1984 GM342693
l (part of), 2 Conavon C:ourt 25 years from
(part of), 3 20.01.1984
(part Of ) , 4
(part of)
NOTE: The Lease also grants a right of way for the purpose only of
loading and unloading and reserves a right of way in case of emergency
only from the boiler house adjacent hereto
6 14.06.1984 Part of Third Floor Conavon 31.10.1983 GM347623
3 (part of) Court 25 years from
31.10.1983
7 14.06.1984 Part of the Third Floor 31.10.1983 GM347623
3 (part: of}, 4 Conavon Court 25 years from
(part of) 31.10.1983
8 01.10.1984 "The Italian Stallion'' 17.08.1984 GM357142
4 (part of) Conavon Court (Basement) 25 years from
20.1.1984
NOTE: The Lease also grants a right of way for the purpose only of
loading and unloading and a right of access through the security door
at the reaar of the building
9 06.07.2016 3rd floor 14-16 Blackfriars 28.06.2016
4 (part of}, 5 Streec 5 years from
(part of) 25/06/2016
That's the beauty of OCR, every run can be a different pass rate per character so experience says use best of three estimates. Thus run 3 different ways and comparing character by character keep those that are in agreement.

Data sets for emotion detection in text [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm implementing a system that could detect the human emotion in text. Are there any manually annotated data sets available for supervised learning and testing?
Here are some interesting datasets:
https://dataturks.com/projects/trending
The field of textual emotion detection is still very new and the literature is fragmented in many different journals of different fields. Its really hard to get a good look on whats out there.
Note that there a several emotion theories psychology. Hence there a different ways of modeling/representing emotions in computing. Most of the times "emotion" refers to a phenomena such as anger, fear or joy. Other theories state that all emotions can be represented in a multi-dimensional space (so there is an infinite number of them).
Here are a some (publicly available) data sets I know of (updated):
EmoBank. 10k sentences annotated with Valence, Arousal and Dominance values (disclosure: I am one of the authors). https://github.com/JULIELab/EmoBank
The "Emotion Intensity in Tweets" data set from the WASSA 2017 shared task. http://saifmohammad.com/WebPages/EmotionIntensity-SharedTask.html
The Valence and Arousal Facebook Posts by Preotiuc-Pietro and
others:
http://wwbp.org/downloads/public_data/dataset-fb-valence-arousal-anon.csv
The Affect data by Cecilia Ovesdotter Alm:
http://people.rc.rit.edu/~coagla/affectdata/index.html
The Emotion in Text data set by CrowdFlower
https://www.crowdflower.com/wp-content/uploads/2016/07/text_emotion.csv
ISEAR:
http://emotion-research.net/toolbox/toolboxdatabase.2006-10-13.2581092615
Test Corpus of SemEval 2007 (Task on Affective Text)
http://web.eecs.umich.edu/~mihalcea/downloads.html
A reannotation of the SemEval Stance data with emotions:
http://www.ims.uni-stuttgart.de/data/ssec
If you want to go deeper into the topic, here are some surveys I recommend (disclosure: I authored the first one).
Buechel, S., & Hahn, U. (2016). Emotion Analysis as a Regression Problem — Dimensional Models and Their Implications on Emotion Representation and Metrical Evaluation. In ECAI 2016.22nd European Conference on Artificial Intelligence (pp. 1114–1122). The Hague, Netherlands (available: http://ebooks.iospress.nl/volumearticle/44864).
Canales, L., & Martínez-Barco, P. (n.d.). Emotion Detection from text: A Survey. Processing in the 5th Information Systems Research Working Days (JISIC 2014), 37 (available: http://www.aclweb.org/anthology/W14-6905).

Chasing game in C [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I'm stuck with a quite complex problem:
On an MxN field containing a chicken, an eagle and a yard,
the chicken tries to escape the eagle (by entering the yard),
and the eagle tries to catch the chicken. The chicken escapes
when reaches inside the yard, and the eagle catches the chicken
when it's in the same position as the chicken. In a single step,
the eagle can move one or two small squares, and the chicken can
move a single square in any direction. The program should display
a message saying if the chicken can win. It should compute the moves,
and, at each step, it should write in the output file the current
configuration of the field, and it should also visually represent
it on the screen. The dimensions of the field, position of the chicken
and of the eagle, and also of the yard, are given in a file.
I've solved the part with creating the field (a matrix), but I can't figure it out how to solve this. Perhaps backtracking would be an idea, but it's very complicated, and I can't handle it. I think I should find a way to find out the distance between the chicken and the yard, also between the eagle and the yard, and work somehow with that. It has to be in C. Any suggestion, idea is welcomed!
Thank you in advance!
It is an interesting problem. Let's go over the rules again. Players
Chicken: takes shortest path to field (there could be multiple shortest paths) and away from eagle (maximise the distance between itself and eagle among shortest paths).
Eagle: takes shortest path to chicken
To solve the problem we have to assume it is played in turns: first chicken then eagle and so on.
Game is over when :
Eagle is on chicken.
Chicken is on field.
Here is the trick for the distance:
Update
The distance you want is called Chebyshev distance. You can easily calculate it:
distance = max of(difference of corresponding coordinates between the two points)
For (1,1) and (2,3) distance = max(|1-2|,|2-3|) = 2
For (2,3) and (4,7) distance = 4
For (4,5,6) and (1,1,1) distance = 5
You can ignore the older answer if you want.
Old
distance = Manhattan distance - length of longest 45 deg diagonal
Manhattan distance is easy to understand. See its wiki. Take some examples :
---/F
--/-|
-/--|
C---X
manhattan distance = 7
length of max diagonal = 3
distance = 7-3 = 4
Another one
---/-F
--/--|
-/---|
C----X
distance = 8-3 = 5
Caveat: Remember there can be many shortest possible paths. For eg.
---F
--/F
-/-F
C--F
-\-F
--\F
---F
Lots of places to go in 3 moves. Pick one which is farthest from eagle using distance calculator.
Also if distance between eagle and chicken is less than chicken and field at any time then eagle wins else chicken. Just simulate the moves and you will know.

Why is a database always represented with a cylinder? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
This question came up today and I couldn't find any historical answer as to why a database is always represented as a cylinder. I am hoping someone in the stack world would know why and have a link or something backing it up.
I'm reasonably certain that it predates disk drives, and goes back to a considerably older technology: drum memory:
Another possibility (or maybe the choice was based on both) is a still older technology: mercury tank memory:
You may have seen the symbol oriented horizontally instead of vertically, but horizontal drums were common as well:
You asked for more pics. I took these at the computer history museum in Mountain View, CA in May 2016.
Description for the above image says:
UNIVAC I mercury memory tank, Remington Rand, US, 1951
For memory, the UNIVAC used seven mercury delay line tanks. Eighteen pairs of crystal transducers in each tank transmitted and received data as waves in mercury held at a constant 149°F
Gift of William Agee X976.89
Description for the above image says:
Williams-Kilburn tube - Manchester Mark I, Manchester University, UK, ca 1950
This was the memory in the Manchester Mark I, the successor to the "Baby." It stored only 128 40-bit words. Each bit was an electric charge that created a spot of light on the face of a "TV tube."
Gift of Manchester University Computer Science Department, X67.82
It's because people view a DB as simple storage, much like a disk. And disk storage has always been represented by a cylinder due to, well, the physical properties of spinning magnetic disks.
I always assumed it stood for the round edges of a hard drive platter. The average consumer might not have necessarily known what a Physical Hard Drive Component looked like, so it was represented as a cylinder.

Resources