How do I plot tweets as points on an image in processing? - api

I've been trying to plot tweets with certain hashtags on a picture in processing but haven't been able to find any good resources or assistance.

It's really hard to answer general "how do I do this" type questions. Stack Overflow is designed more for specific "I tried X, expected Y, but got Z instead" type questions. That being said, I'll try to answer in a general sense:
You need to break your problem down into smaller steps.
Step 1: You can draw your image using the image() function. Get a sketch working that does just this without worrying about the tweets just yet.
Step 2: You can use a library like Twitter4J to retrieve tweets with certain hashtags. Put together a completely separate sketch that just retrieves tweets and prints them out to the console. Don't worry about displaying them.
Step 3: You can use the text() function to display text on your screen. Again, get a simple application working first before you try combining it with the other steps.
When you have each of those steps working by themselves, then you can start thinking about combining them into one sketch. Focus on one small step at a time, and post an MCVE if you get stuck. Good luck!

Related

How to use Alignment API to generate a Alignment Format file?

I am going to attend the Instance Matching of OAEI, now I need to make my results to Alignment Format. In order to achieve it, I have learned official tutorials.(link:http://alignapi.gforge.inria.fr/tutorial/tutorial1/index.html).
But there are many differences between the method taught and the method I want. In other words, I can't understand the API.
This is my situation:
I have 2 rdf file(person11.rdf and person12.rdf respectively.data link is http://oaei.ontologymatching.org/2010/im/index.html, the PR dataset), each file has information of many person. I want to find the coreferent entities, the results must be printed in Alignment Format. I find the results by using SPARQL, but I don't know how to print it in Alignment Format.
So, I have three questions:
First, if I want to generate a Alignment Format file, is the method taught the only way?
Second, can you give me your method(code better) to generate the Alignment Format file? Maybe I am wrong from the beginning, can you give me some suggestions?
Third, if you attended OAEI or know something about Instance Matching, can you give me some advice? I want to find the coreferent entities.
Thank you!
First question: I guess that the "mentioned method" is the one in tutorial1. It is not the appropriate one since you have to write a program to output the alignment format and this is a command line interface tutorial. In this case, you'd better look at http://alignapi.gforge.inria.fr/tutorial/tutorial2/index.html
Then, there are basically two ways to do:
The advised one (for several reasons and for participating to OAEI) is to follow these tutorials, to create an empty alignment in it, to create the correspondences from the results of your SPARQL query and to render it. Everything is covered by the tutorials but the part concerning your SPARQL queries. This assumes that you are programming in Java.
The non-advised solution (primarily non advised because you will have to debug your own renderer), is to write, in any programming language that you want a program that output the format (which corresponds to what you cite).
Think about it: how would you expect that the Alignment API knows the results of your SPARQL query? If you come up with a nice solution, contact the API developers, they may integrate it and others could benefit.
Second question: I cannot do better than what is above.
Third question: too general. Read the OAEI results (http://oaei.ontologymatching.org) and look at the code of others.
Good luck!

In Qualtrics, how to hide a slider from being displayed until a response is given?

I'm trying to create a survey containing several slider-type questions, asking participants to select a point on a line to indicate their experience of different emotions. For example:
Not at all anxious -----------------------|---------------------Extremely anxious
These questions are meant to serve as visual analogue scales (VAS), often used in my field but typically administered via paper/pen. A digital VAS would be very useful for my research, but I have 2 problems with the Qualtrics format.
First, I need to hide the vertical slider until participants selects a point on the line (in effect removing any visual "starting point" that can influence responses). Second, I can't force participants to respond to every question, so I need a way to distinguish those who skip a question/don't answer (including code to check if the slider was displayed or not displayed when the participant chooses to continue to the next question might work, so that Qualtrics stores no response for that question if the slider is still hidden).
Thanks for the help! I'm not a coder, so I would really value any and all advice!

Rails 3 multi-step form with file upload

I having some trouble trying to figure out how to implement a Rails 3 multi-page form with file uploads, where each step is handled by the update/edit actions in the controller.
Ryan Bates provided his wonderful screencast for how to to do multi-step forms using sessions, as well as a brief description on how to accomplish something similar by saving to the database on the initial step and then perform updates on each successive step. I have also read his gist giving a more detailed explanation of some different options on how to create a multi-step form (I am leaning toward option 1).
But I am still quite a bit lost when it comes to the actual implementation of a multi-step form. My goal is to use carrierwave for the file uploads (images), and perhaps workflow by geekq for the state machine to help with with validations at each step.
Just to be clear, I am currently trying to create an entry in the database on the initial step of the wizard, and have each successive page update the model.
Any ideas?
An example or a point in the right direction would be greatly appreciated.
Thanks!
Note: I have read another post where they mention something about a key/value data-store, but that unfortunately is a bit over my head...
Key-Value store or SQL for that matter are very loosely tied to your actual problem. Those are just a different approaches on how your data are actually stored in the backend. Using one way or another doesn't really make a difference in your case.
As for the actual question I think its too general for SO. Multistep forms tend to be very different one from another. There is no "one good way" of doing those.
The reason you are not getting any answers on this is probably because there is no real question asked. What you should do is to try to do actual implementation and post more specific questions when hitting the wall somewhere.
In the end - I believe the multistep forms are not really the best idea when it comes to usability. Of course there are valid reasons to use them in some cases, but you should really think twice if there is a way to avoid those in your case.
One of the problems I had while ago with forms and uploads was the validation (It isn't related to Multi/Single step specifically). Normally when validation fails user would have to re-upload the file. Fortunately in your case this not much of an issue, since Carrierwave handles that automatically.

global variables, arrays, and search results

I am trying to write an app that searches a website, and takes all of the results and puts them into a customized table. I am an Objective-C and iPhone SDK noob, and am hoping that this logic is what I am trying to accomplish:
1) Searching multiple search engines and pulling all of the data off of each website, storing each into a different array (for example: Searching Google, Yahoo, and Bing for "Shoes", and taking all of the different search results, hyperlinks and all, and storing them into three different arrays)
2) Pulling the data out of each array, and putting into a table (Table view in Interface Builder)
I am assuming that I need to declare global variables, so that they can be called from different classes......right?
What's the syntax for doing this?
How do I set this up in IB?
Did I bite off more than I can chew for this first app?
Thanks for your help!
Aaron, I also think you're biting off more than you can chew WRT a single question on SO, but let me point you to a resource I wrote on a similar topic about how to structure your program.
As an Obj-C noob, you're going to need to take extra care to remember the Model-View-Controller pattern. Extracting data from a web site is a bit of work - and you want to keep that very separate from your display and control code.
Have a clean API model that extracts and sorts data, and have a clear view controller class that reads data from the API.
My advice is to write the whole app in psuedo-code first and try out your thinking on us.

optical character recognition of PDFs of parliamentary debates

For a contract work, I need to digitalize a lot of old, scanned-graphic-only plenary debate protocol PDFs from the Federal Parliament of Germany.
The problem is that most of these files have a two-column format:
Sample Protocol http://sert.homedns.org/img/btp12001.png
I would love to read your answer to my following questions:
How I can split the two columns before feeding them into OCR?
Which commercial, open-source OCR software or framework, do you recommend and why?
Please note that any tool, programming-language, framework etc. is all fine. Don't hesitate recommend esoteric products, libraries if you think they are cut for the jub ^__^!!
UPDATE: These documents are already scanned by the parliament o_O: sample (same as the image above) and there are lots of them and I want to deliver on the contract ASAP so I can't go fetch print copies of the same documents, cut and scan them myself. There are just too many of them.
Best Regards,
Cetin Sert
Cut the pages down the middle before you scan.
It depends what OCR software you are using. A few years ago I did some work with an OCR API, I cant quite remember the name but I think there's lots of alternatives. Anyway this API allowed me to define regions on the page to OCR, If you always know roughly where the columns are you could use an SDK to map out parts of the page.
I use Omnipage 17 for such things. It has an batchmode too, where you can put the documents in an folder, where they was grabed, and put the result into another.
It autorecognit the layout, include columns, or you can set the default layout to columns.
You can set many options how the output should look like.
But try a demo, if it goes correct. I have at the moment problems with ligaturs in some of my documents. So words like "fliegen" comes out as "fl iegen" so you must spell them.
Take a look at http://www.wisetrend.com/wisetrend_ocr_cloud.shtml (an online, REST API for OCR). It is based on the powerful ABBYY OCR engine. You can get a free account and try it with a few of your images to see if it handles the 2-column format (it should be able to do it). Also, there are a bunch of settings you can play with (see API documentation) - you may have to tweak some of them before it will work with 2 columns. Finally, as a solution of last resort, if the 2-column split is always in the same place, you can first create a program that splits the input image into two images (shouldn't be very difficult to write this using some standard image processing library), and then feed the resulting images to the OCR process.