MikeAir Posted February 6, 2015 Posted February 6, 2015 Hi guys, First of all I want to let you know about: www.monkeylearn.com which is a online free tool for conduction sentiment analysis on text data(they are not paying me to say that ). Having looked through the page, i appears that you can create an API for your algorithm, and then either paste som text in a field on the webpage itself. Or you can paste the API-code in your own script, and make it work for you even smarter. I it looks like they support the following languages for export of an API: CURL(The terminal command), Python, RUBY, PHP, Javascript, Java & .Net However, is it possible for me in any way to include this API in a filemaker solution(does filemaker integrate with either of the above languages)? I was hoping to include the API as a calculation, referring to a text field in big dataset i currently have arranged in filemaker. Regards, Mike
comment Posted February 6, 2015 Posted February 6, 2015 cURL is available on Mac OS X as standard and Filemaker can communicate with it through AppleScript. However, skimming through the documentation here: http://www.monkeylearn.com/docs/api.html I see that responses are provided in JSON format. Consuming such response presents a challenge on its own - possibly a much bigger one than querying the API in the first place. I suggest you try working it out using the BaseElements plugin, which IIRC can execute cURL calls (on both platforms?) as well as parse JSON.
jbante Posted February 6, 2015 Posted February 6, 2015 In addition to the methods for using cURL in FileMaker, there are plug-ins that will let you access all those languages except C# (.Net) in FileMaker: bBox — Python and Ruby SmartPill — PHP ScriptMaster — Java (via Groovy) For JavaScript, you can export any resources you need to disk and run it in a web viewer, which does not require any plugin. I was hoping you might be able to access the API directly in FileMaker without an intermediate language using the Insert From URL script step, but the API appears to be using HTTP headers, which the script step doesn't expose to us; so you're stuck with the other methods. I wouldn't consider parsing JSON much of a challenge, but another option if you don't want to do it on your own with FileMakers text functions is to use the JSON module.
MikeAir Posted February 6, 2015 Author Posted February 6, 2015 For JavaScript, you can export any resources you need to disk and run it in a web viewer, which does not require any plugin. I was hoping you might be able to access the API directly in FileMaker without an intermediate language using the Insert From URL script step, but the API appears to be using HTTP headers, which the script step doesn't expose to us; so you're stuck with the other methods. I wouldn't consider parsing JSON much of a challenge, but another option if you don't want to do it on your own with FileMakers text functions is to use the JSON module. So, maybe by using this methodology: http://www.soliantconsulting.com/blog/2014/04/getting-started-javascript-and-filemaker And inserting: fmp:// & Get ( FileName ) & Table::FieldwithTextToBeAnalyzed Into the "This is the text to test the API." line in a web viewer: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>MonkeyLearn Javascript Integration</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" ></script> <script type="text/javascript"> $.ajax({ url : "https://api.monkeylearn.com/api/v1/categorizer/cl_5icAVzKR/classify_text/", type : "POST", headers: { "Authorization": "token XXXXXXXXXXXXXXXXXXXXXXXXX", }, data : { text: "This is a text to test the API." }, success : function(result) { alert(result); }, error : function(e) { alert('Error: ' + e); } }); </script> </head> </html> ....... And somehow retrieve function(result) to another field?
Wim Decorte Posted February 7, 2015 Posted February 7, 2015 Turning the tables a bit, you can certainly use all of the APIs to create a "middleware" web page that both reads from FM and consumes the sentiment API, and then delivers the analysed payload back to wherever, including FM. There are FMS APIs for PHP (native) and for Ruby (Rfm) and for .NET (fmdotnet) and for Python (Pymaker),... so you can pretty much pick what you are comfortable with and pull data from FM, analyze it and push the result back. No need for plugins even, you can initiate the call from inside FM using "insert from URL" or using a Web Viewer object. Edit: missed the part where Jbante mentioned that you may need to use custom headers for the sentiment API calls, but that does not matter... you can make a call to your intermediate web service (the one you write) to conform with what the FM "insert from URL" offers in ways of HTTP POST or HTTPS POST. 1
MikeAir Posted March 3, 2015 Author Posted March 3, 2015 Hi guys, Just want to update you on the limits of Monkeylearn, free version: There is a limit of 1000 API-calls per month, which became a problem for me(using it for a bachelor thesis). But then i found out there is another service called Metamind, which have a limit of 1000 API-calls per day.. https://www.metamind.io/ This service can actually provide an algorithm for recognizing patterns in images as well. 1
Recommended Posts
This topic is 3551 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now