A method for calculating pattern relevance in a text

This article aims at presenting a method for computing the relevance of a given string (pattern) in a text. This algorithm is at the core of my WordPress plugin Smart Tag Insert.

First of all, there is a difference between a simple pattern matching and computing text pattern relevance. The question we are trying to address here is the following: I have a string, and I would like to know how much that string is relevant for a specific text. For example, let’s say we have “download music” as the string of which relevance we are interested into. How can we determine how much relevant it is for a specific article?

The simple approach

The easy thing one could try is run a pattern match of “download music” in the article text. That is okay, but suppose the article contained strings like “download the music”, or “download some music”, or “downloading music”, or “download good quality music”. It is clear that, to a human, all these strings are equivalent when trying to understand what the article is about: it is about downloading music, regardless of whether it is good, bad, a lot or little.

A simple pattern match would fall short, because it would exclude all those other strings and make it look like the content is not very much about downloading music, just because “download music” was never found exactly that way.

So the first point we need to acknowledge if we want to try to teach a machine to compute text pattern relevance, is that we need to find a way, at least a rough way, to teach it to grasp the meaning of the content.

Continue reading

New System76 Lemur 2016 review (6th gen Intel core)

On December 2016 I purchased the System76 6th gen Lemur. These are more of impressions than a real review, but may be helpful if you’re interested in buying a new laptop and were considering the new System76 Lemur. This is the review of the laptop released in December 2015. I purchased the version with Intel Core 6th gen i3 6100U, 8GB DDR3 and 256 GB SSD.

Continue reading

IPSC 2014: Imagination is more important than knowledge

From 12th to 17th May I took part to the International Public Speaking Competition (IPSC) 2014 in London, representing my country, Italy. The topic was Imagination is more important than knowledge, and the title of my speech, which follows, was The largest dancing floor. The video of the italian version is available on YouTube or at the bottom here.

THE LARGEST DANCING FLOOR (Italian candidate speech)

What I propose today is a journey. A journey with our imagination, through physics, to disclose a picture of the world far more appreciable than the one we usually have.

Have you ever thought about how fake the reality we see is? Looking around us, we see all kinds of different things. And yet, it looks to me that we give for granted the most basic assumption, which is that these things exist as we see them. I mean, we see a penguin and we think that yeah, that’s the classic example of the capital-P Penguin, of the “penguiness”. But where is this “penguiness” to be seen? Can we think of it? Can we say it is real?

Continue reading

Tutorial: Use PayPal Adaptive Payments API (with Embedded Lightbox)

There are two things I am currently working on:

  1. School
  2. Integrating my Post Pay Counter WordPress plugin with PayPal, so that site administrators can pay their writers directly from their blog pages, without having to head to the PayPal website

Apparently, it turns out that you do not get to choose how much time you want to dedicate to the first point. That, matched with the fact that PayPal APIs are horrible and that the documentation is often useless, is making the whole process much longer than I thought. Meanwhile, I am sharing what I have come up with until now (which works pretty well, actually), scheduling a second part of the tutorial for when the job will be completed.

PayPal Adaptive Payments: what it is for

Adaptive payments handles payments between a sender of a payment and one or more receivers of the payment. You are an application owner, such as a merchant that owns a website, the owner of a widget on a social networking site, the provider of a payment application on mobile phones, and so on. Your application is the caller of Adaptive Payments API operations.

Standing to what I have been able to discover about PayPal’s different payment mechanisms over summer, Adaptive Payments represents the most flexible way to transfer funds from one account to another. Also, it seems the only method you can effectively integrate PayPal in your application. Adaptive Payments is in fact for those applications in which your account, as application developer, is not the one you are drawing funds from. Shortly, you need to move money on behalf of someone, and your application is the intermediary.

In my specific case, I needed a way to let administrators put their credentials into my plugin and have PayPal let me get money from their accounts and transfer it to their writers’ ones. Adaptive Payments method was really suitable because it allows six transactions per each request, so that it is possible to send different amounts to several people with only one API request. As bottom line (which I did not need and did not care to dive into), it also allows Chained Payments, in which the primary receiver passes part of the payment to other receivers, splitting the original amount.

Continue reading

Posts To-Do List: keep track of writing ideas

I worked for several blogs and websites. In most of them, we often felt the need to share hints and ideas about future posts, about what each of us stumbled upon while surfing. Unfortunately, there was not a great way to fulfill that need, and we often told each other via email, or emailed the admin who would in turn forward to all the writers. That is the reason why I wanted to build a WordPress tool that could simplify this sharing process.

That WordPress tool is a plugin and is called Posts To Do List. 

Continue reading

When you start a new project, think big!

As you may know, I am the happy developer of a WordPress plugin called Post Pay Counter. I dare say that that has been my first serious coding project, well thought and well written. It taught me a lot, above all the concept that when you start a new project, you should think as if it was going to become a huge one. This is what I’d like to share with you today.

When I started developing the Post Pay Counter project it was two years ago. I took it up because a friend of mine needed it, and asked me if I could set up a plugin that could simplify writers payments. That was how the project started. Looking back at that time, I can clearly identify an error that came along with me and, partly, is still with me today: the idea that was not going to be an important plugin, that I would not have edited it much after, that I would not have added almost anything… that so it was, so it would have remained. What did this practically mean?

Continue reading

Have I told you we should abolish Facebook?

Yesterday it was my birthday.

My family phoned me or just met me. Then there has been a handful of people who texted me on my mobile, mostly in the morning. I do not care how they remembered my birthday’s date, what I care about is that they took the time and the money (for those who paid) to text me. I am not ashamed to admit I use myself both Facebook and my mobile phone agenda to keep track of birthdays, apart from certain ones that are quite stuck in my head. But what I liked is that those people, the ones who texted me, tried to think of something nice to write and they actually came up with something sweet, something you would fancy reading after waking up. Those were the people closer to me. Some of them even told me that it was Facebook that remembered them it was my birthday, but they actually sent me an SMS and did not use Facebook to write me.

Continue reading

The fourth way: the digital knowledge

Amazon.com, great pioneer of the digital book, declared that, starting from April 2011, electronic papers/hardback sales have overtaken the paper ones 105 to 100: small achievements, you will probably grin, but if it is not this that hints us the future evolution of multimedia, what else?

I will take it from far…

Nowadays, one’s cultural baggage is discernible by the size of the bookcases available in their house – and obviously by the quality of the papers there stored -, but in the future? Sooner or later, like it or not, all this is going to change: all the contents we keep in a physical form, so CDs for music, DVDs for films and books for literary works, tomorrow will not be recorded on medias, but they will be much more ethereal and impalpable indeed.

It is a phenomenon which, after all, has started years ago and keeps evolving during time. Apple’s iTunes Store has been, in 2003, the first attempt of music sales in a digital form, featured by a very positive feedback. In recent times, Amazon.com has taken and extended the idea in a significant way, offering not only music purchase under a download form, but also software, films and books. All the bought items were then to build a personal shelf which could be accessed from any location. Google as well, with its Google Music project, is testing its new music purchasing and selling service.

Continue reading

When YouTube pages load with no CSS: how to solve

I have been unable to watch YouTube videos for a couple of months. There were some people on the Google Forums reporting the same problem, also posting screenshots, but no one seemed to be able to fix it.

Finally, checking with despair my Chrome Dev Tools, I found the problem! In my rush to block ads and avoid the slowing down produced by all the requests to external domains, I ended up redirecting s.ytimg.com to my own PC. Sadly, it seems YouTube is taking some CSSes and other stuff from there, reason why I was unable to watch any video and load the home page with a decent view.

Continue reading

How Facebook is killing real relationships

I’ve always had strong opinions about the Facebook phenomenon and all that virtual social stuff, I have always said they are ruining our life and actually destroying our real social interactions. Today I think that’s true more than ever, and I will tell you why.

My opinion is that Facebook is something to pop up at 9 in the evening, when after a 14 hours day you are too tired to do anything else. You open it and just start lurking around new friends embarassing photos (like grils’ bikini ones), laughing at childish status updates and links and browsing your groups recent activities. At least, that is how I use that damn website, publishing hironyc and nonsense content without really telling people nothing serious about myself. Quotes are the farthest thing I do. Instead, people use to put there all their lives – their interests, hobbys, wants, likes and dislikes and, most important, friends interactions. We’ve all seen that “John is engaged with Melissa” with around 15 likes under it and as many comments saying “man enjoy it” or “sis I’m so happy about that!”. Few people actually realize they are losing the real social interaction that piece of news may have generated. Remember the old style way – just to wait to really meet the people you care about and tell them orally or, better, organize an appointment?

Continue reading