Affichage des articles dont le libellé est lang:en. Afficher tous les articles
Affichage des articles dont le libellé est lang:en. Afficher tous les articles

samedi 24 mars 2012

INTEX, UNITEX, NOOJ

Some technologies I'd never heard of but probably should have:

Unitex - a corpus-processing system

Nooj - a linguistic development environment

INTEX  - a linguistic development environment

vendredi 16 mars 2012

Twitter-scraping with Python for Dummies (in Windows)

I'm ok with Python but it took me a while to get this set up, and all the "easy guides" seem to start from Linux.
Compiled from a couple of pages, and some trial and error.


You will need:




Step 1: Get your Twitter Api key
You will need to be a twitter user to get an api key. You will need an api key for some of the things you'll do later. You don't absolutely need to do this step right now but it's probably eaiser.
This explains the process pretty clearly When you're filling out the form, it doesn't matter what you put in the fields for "app name" and "website", etc.
You will also need the access token, so click on the button at the bottom of the page to get that.

Also, go into your settings (there should be a tab at the top of the page), scroll down to 'Application Type' and choose 'Read and Write'. This will mean you can update your twitter status, and things like that. (Then, obviously, scroll down and click on 'Update this Twitter application's settings')
If you'd already created your access token before doing this, you will need to re-do that to update it with the new permissions. Click 'Recreate my access token'.


Step 2: Download the python wrapper for the twitter api and its dependencies 
Open up a Command Prompt
( Start->Accessories->Command Prompt )
Type: cd c:\Python27\scripts  

Type:  easy_install simplejson
(wait. read what's on the screen - hopefully not an error)

Type: easy_install httplib2
(wait, etc)

Type: easy_install oauth2
(wait, etc)


Type: easy_install twitter
(wait, etc - and if that doesn't work, try: easy_install pip
then: pip install twitter )


You should now be good to go.



Step 2: Setting up the twitter api wrapper in python
Open up a Python shell window. You should get this if you go :
Start -> Programs -> Python27 -> IDLE (Python Gui)
It should look like this:


Type:  import twitter
(nothing happens)

Type: api = twitter.Api()
(nothing happens)

We're now referring to the official documentation here.

Type:  
api = twitter.Api(consumer_key='consumer_key', 
consumer_secret='consumer_secret', 
access_token_key='access_token', 
access_token_secret='access_token_secret')
- Except that where it says 'consumer_secret', 'access_token', etc (everything with the single quote marks), write in the Consumer Key / Consumer Secret / etc that you got in Step 1. Keep the quote marks.
Also, you don't need to press Enter between these lines, but it doesn't matter if you do.

To check that that has worked, type:
print api.VerifyCredentials()
When you press Enter you should get a bunch of text (hopefully not any errors).

What would be a good idea right now is to save this script, so that you don't have to go back and remember/retype all of that next time you want to work.
(In the Python Shell window,  File->Save)


Step 4: Try a few things out
(These are from the Google Code page):


allstatuses = api.GetPublicTimeline()
print [s.user.name for s in statuses]


statuses = api.GetUserTimeline("user")
(The username is text, so must be in quote marks)

friends = api.GetFriends("user")
print [f.name for f in friends]
(For list of people the user is "following")


and... away you go. full documentation here.

jeudi 1 mars 2012

An afternoon in style on the Internet

Over at Language Log, Mark Liberman writes of the "serendipitous conversational cross-fertilization comes from random encounters in the corridors and cafeterias of the internet". And the example he chooses happens to be about stylistics and measuring text similarity! Serendipitous indeed.

A couple of useful links/references (blog and academic):

Ted Underwood, "The differentiation of literary and nonliterary diction, 1700-1900", (Blog: The Stone and the Shell, 26 feb 2012)
- Ted Underwood diachronically compares literary text genres (poetry, drama, fiction) with non-fiction. Comparing word-frequency similarity, he finds that over time (1700 to 1900) the literary genres became less and less similar to non-fiction.

Interestingly, he also finds that, over that time period, non-fiction changed the most in relation to itself - that is, it changed the most as a genre. (He discusses some of the possible reasons for this so I won't repeat them here)

As Mark Liberman mentions, an obvious limitation is that this measure of similarity will depend on topic as well as style or diction.
I still need to go back to this later to look again at the stats and details.



Arvind Narayanan in "Is Writing Style Sufficient to Deanonymize Material Posted Online?" (Blog: 33 Bits of Entropy, 20 feb 2012) (blog also links to draft of forthcoming paper, "On the Feasibility of Internet-Scale Author Identification") looks at identifying blog authors:
"We were able to obtain about 2,000 pairs (and a few triples, etc.) of blogs, each pair written by the same author [...]. We added these blogs to the Spinn3r blog dataset to bring the total to 100,000. Using this data, we performed experiments as follows: remove one of a pair of blogs written by the same author, and use it as unlabeled text. The goal is to find the other blog written by the same author. We call this blog-to-blog matching. Note that although the number of blog pairs is only a few thousand, we match each anonymous blog against all 99,999 other blogs."

Take-aways: 
- I discovered the term "stylometry", which is more specific and useful than what I had been calling "sort of like forensic linguistics".
- I have a lot of reading to do on stylistics (and stylometrics). Because basically all I had so far was Coupland (2007) Style: Language Variation and Identity, Cambridge University Press. [reviews: 1, 2]



AND THEN

Two minutes on Twitter means I come across this, from Google Research: Quantifying comedy on YouTube: why the number of o’s in your LOL matter, looking at the comments under YouTube videos. Variations in these "laughs" (lol, loool, aha, hahaha, etc... not to mention the recent comeback of "mwahaha") is exactly one of the things I was counting on looking at - my hypothesis is that the choice of one of these will strongly depend on the community context in which we are speaking. For example, we know that for some people, "lol" is totally uncool and would only be used ironically, in the form of "LOL" or "LULZ" in an otherwise capitalisation-free discourse.
The different types, and amount of, emphasis we might use (as the post describes, "e.g. capitalization (LOL), elongation (loooooool), repetition (lolololol), exclamation (lolllll!!!!!)") is another variable.

Google's research question is different: They're looking at to what extent this variation might be an indicator of the funniness rating of the video by the viewer. Though they admit that "funniness" is a difficult question (humour preference is subjective), they apparently have some human-annotated data to train classifiers with. Also, they took video tags (and, presumably, the video title) into account. And some audio-visual features. So, that sounds like fun.
Just when I'm wondering why I can't intern at Google, here are two things I need to look into:
1) What is a "passive-aggressive" ranking algorithm? Does it leave notes on the fridge rather than speaking to you, or does it secretly give items controversial rankings? Maybe I need to watch this.
2) "human-annotated pairwise ground truth" - I've assumed this refers to a human-annotated training corpus, but I haven't heard of "ground truth" before. Hmm.

And their references (copy-pasted):

“Opinion Mining and Sentiment Analysis,” by Bo Pang and Lillian Lee.
“A Great Catchy Name: Semi-Supervised Recognition of Sarcastic Sentences in Online Product Reviews,” by Oren Tsur, Dmitry Davidov, and Ari Rappoport.
“That’s What She Said: Double Entendre Identification,” by Chloe Kiddon and Yuriy Brun.


Plus, from the comments:

Biel, J-I. and Gatica-Perez, D. VlogSense: Conversational Behavior and Social Attention in YouTube. ACM Trans. Multimedia Comput. Commun. Appl. 2, 3, Article 1 (May 2010)
Biel, J-I., Aran, O., and Gatica-Perez, D. "You Are Known by How You Vlog: Personality Impressions and Nonverbal Behavior in YouTube".In  [I think] ICWSMThe AAAI Press (2011) .

dimanche 12 février 2012

"Twitterology" in the New York Times

Ben Zimmer (of Language Log) writes in the New York Times on "Twitterology - A New Science?".

  • Some of the possible uses of Twitter data: Linguistics, Sociology, Psychology...
  • Advantages of Twitter mining: naturally-occurring data
  • Recent work: "on the ground sentiment over the course of the Arab Spring"
  • Criticisms of sentiment analysis: can moods be extracted from word selection?

vendredi 9 décembre 2011

Future Research Titles


When I grow up...

There are lots of reasons why I'm not doing these pieces of research RIGHT NOW, and most of them are things like: I can't do everything at once / I don't think I'm skilled enough to do that right now / I think I need to develop that idea a bit more / I just have other priorities.

But these are some things that I'd like to, some time in the future, look into.


4-chan
"Meme"-development in 4-chan.
Standard "memes" (pictures, games, etc.), lexic, communication codes and practices.
(On one hand, I do wonder if I should start collecting this corpus before it gets too late (outdated)...)

Forensic linguistics
This was what I wanted my dissertation project to be on (sort-of). What are the distinguishing features of a given person's (written) discourse?


A study on linguistic variation and social identity in the island of Jersey
The island of Jersey is 45 square miles of linguistic diversity.
Kids are born there, grow up there, and by the time they're 15 or 16 might be speaking like they're from Oxford, London, Brighton or Manchester; like they've just come off a beach in Australia or off a TV show in America.
I'm pretty sure this is a phenomenon that exists elsewhere (any given region of the UK, maybe?) but the small, contained, geography, and (it seems to me) lack of a stereotypical, or at least fairly representative sociolect (as you might have in Yorkshire) seem to make it an interesting potential object of study.

In 'sociolect' I'm including accent.

There is a 'Jersey' accent, but it's rare to hear on anyone under the age of 50.
Although, back in the day, a slightly different version of Jerrais was spoken in Gorey (East) from St Ouen (West), the differences today in English are not geographical.

Y'see, there's two (main) parts to this question: accent and lexic. And as fascinating as accent is (for me: generally just in the way of "wow, I love that accent") I'm really not a phonologist of phonetician. I struggle with doing IPA notation - I'm pretty sure I don't have the "ear" and would be pretty terrible at doing transcription.

The lexical part would be great, but maybe it would be even better if it was teamed with someone else (doing the accent part).

Still - there are a lot of preliminary issues. What factors to take into consideration in defining social identity? What corpus to take? How? (Given that the phenomonens studied will vary by situation - who is the speaker talking to, when/why?)

A non-trivial question: would anyone fund this research? Given the attitude of some, it seems difficult to imagine...

mercredi 5 octobre 2011

Definitely twitter?



So, I'm thinking... twitter is maybe not the best corpus, really. (See pourquoi twitter?)


Main disadvantages: restraints (character limit) are likely to make the corpus more homogeneous; friendship/social connection data is uncertain.




Other possibilities: 

  • facebook - I felt that the main problem with this would be data rights issues. That being said, I'm not sure that the twitter data is free (to anyone, to do what they want with) either. Of course, there's the justification that it would be for research rather than commercial purposes. On the other hand, the difference between facebook and twitter is that (most) people on facebook protect their data to some extent - making it only available to their friends, for example. If I were to use data accessible from my own facebook account, I would definitely need to ask permission from the (potential) participants.
    The amount of data I could get from facebook would be a lot smaller than that from twitter, but this isn't necessarily an issue. I'm pretty sure that I could still get enough data do some interesting research.

    Main advantages of facebook data: longer individual posts; better data on social connections.
  • blogs - blogs would provide a lot more data per participant, as individual posts are generally longer than on facebook or twitter. However, the type and amount of interaction on blogs is completely different. I feel like the type of social connection data from here would be "less good", but maybe I need to think about it for a while.

  • forums / newspaper comment sections - this is a totally different set-up.
    For one thing, less social connection data. I guess I would have to take all the discourse from one place and say that that's a social group, and take all the discourse from another place and say that that's another. But I could take data from a hacker forum and from a wine lovers' forum and show that there are linguistic differences... what would be the point?


...trying to think of other ideas.