20 Top Generative AI Companies Leading In 2024
Things Automation: Building A "Natural Language" Parser In Workflow
One of the Todoist features I miss the most as a Things user is the service's natural language parser. Available in the Quick Add field of Todoist for iOS, web, and macOS, this feature is, effectively, Fantastical for tasks. Instead of having to manually select task fields such as projects, tags, or dates, you can take advantage of an easy-to-remember syntax and quickly type them out. As you do that, Todoist will highlight the parts it understands in red, indicating that it knows how to parse them. I entered hundreds of tasks in Todoist using this system, and I think it's an aspect of task creation that every other task manager should implement as well. It makes perfect sense, and it saves a lot of time.
Aside from a half-baked attempt at supporting natural language entry in its date assignment UI, Things doesn't unfortunately offer a quick entry feature comparable to Todoist's. So, of course, I set out to make my own using the app's latest automation features.
Well, kind of. For starters, as much as I'd love to, automation doesn't mean I can make my own interfaces in Things, supplementing the app with my custom UI to more easily create tasks. Things' new URL scheme only lets us send data from other apps such as Workflow or Drafts. More importantly though, the workflow I'm sharing today isn't based on a complex natural language engine such as the one used by Todoist or, say, the Chrono JS parser; I'm just using some special characters sprinkled with some delicious regex to make sure Workflow knows what constitutes a task title, a project, or a due date. Thus the quoted "natural language" in the headline of this story: it's only natural as long as you don't forego the special syntax required to make the workflow run.
That said, I'm quite happy with how this workflow lets me add multiple tasks to Things at once. I've been finding it especially useful at the end of the work day or during my weekly review, when I make a list of all the things I'm supposed to do next and want an easy way to add them all to Things. For this reason, rather than restricting this workflow to Club MacStories members, I thought every MacStories reader could benefit from it and modify it to their needs.
If you're a Club member, you can still look forward to advanced Things workflows over the next few issues of MacStories Weekly; this one, however, has been too useful for me not to share with everyone.
The SyntaxHere's the basic idea: I wanted to build a workflow that would take a sentence formatted in a special way and turn it into a todo object (with metadata) understood by Things. And I wanted to repeat this for multiple sentences in a row, so that instead of launching Things multiple times, Workflow would only open the app once, passing JSON data for all the sentences I had typed.
In simpler terms: I want a workflow that turns this sentence…
Buy 10 hard drives ++A test note here #123 Workflows "Tests" \\tomorrow at 6 pm @admin
…into this item in Things:
And not only that, but I also want this group of lines…
Test new workflow #123 Workflows "Tests" @Research \\today ++A link for reference: https://www.Regular-expressions.Info/lookaround.Html Send "video" to Myke ==Friends \\next Thursday at 1 am #123 Workflows "Tests" @research Ping John via email @admin #123 Workflows "Tests" ==Friends ++I don't know why "lol" 😎 \\tomorrow @Reading WatchKit sweet solution post @Articles @Writing ++ https://marco.Org/2018/02/26/watchkit-baby-apps Reference: https://www.Macstories.Net/linked/why-there-are-no-standalone-apple-watch-podcast-players/ \\today at 6 pm #123 Workflows "Tests" @"Test Tag" ==Articles…to become all these tasks in Things:
And, I want this to happen by launching Things just once, not dozens of times with x-callback-url. The workflow should act as a template processing script that iterates over multiple lines of text in one go, avoiding the dance of opening apps back and forth typically involved with complex URL scheme automations.
Let's start with the syntax. One of the limitations of this workflow is that the title of the task should always be at the very beginning of the line. While I can imagine that some may want to enter dates or tags first, it made more sense (and it was easier for me) to do it this way. In the examples I've included above, you can see how task titles are always the first items on each line; you should do the same when testing the workflow on your devices.
Individual pieces of metadata are then marked up using special characters that are somewhat related to their type. Here's a list of all the supported fields:
There is one important rule that is fairly easy to memorize: special markup characters have to be placed exactly before their associated text without a space. That's it. You can insert these variables anywhere in a line (but always after the task title), omit them, include spaces in the name of projects and tags, or write as much as you want in the note field. You can even include URLs and emoji in a task's note with this system. You can enter multiple tags, but only one project and one heading per line.
Again, for context, here's what some actual lines of text I used for my Things setup look like:
Things parser: write Syntax section #Editorial @Writing \\tomorrow at 2 pm ==Writing Things parser: write Workflow section #Editorial @Writing \\tomorrow at 3 pm ==Writing Things parser: write conclusion #Editorial @Writing \\tomorrow at 4 pm ==Writing Things parser: first edit @Editing \\tomorrow at 6 pm #Editorial ==Editing Things parser: send to Ryan @Editing \\tomorrow at 10 pm #Editorial ==Editing Things parser: publish to MS @Editing \\Thursday at 4 PM #Editorial ==PublishAnd here's the resulting set of tasks in Things:
There are three minor limitations I should point out. Projects or tags with emoji in their names are not supported because I couldn't figure out a way to encode them reliably in JSON using Workflow. In addition, using special characters reserved for formatting of task metadata (@, #, , =, and +) elsewhere in a line may result in regex issues. Wherever possible, don't use those in fields other than the ones they already mark up.
Perhaps more importantly, the natural language date parsing is subject to Workflow's built-in date and time recognition feature. Generally speaking, the Workflow team has done an amazing job at recognizing a variety of English date strings such as "tomorrow at 1 PM", "next Wednesday at noon", or "in 2 days". However, there may be edge cases when a complex date or a non-English sentence returns an error.
For instance, "tra 3 giorni" (which means "in 3 days" in Italian) throws up an error in Workflow: "in 3 giorni" (which is grammatically incorrect) does not, suggesting that support for non-English dates has only been implemented at a basic level in Workflow. I've had great results with all my typical dates in English, but your mileage may vary. I recommend using this workflow to test natural language dates and times in Workflow.
I tried to come up with a syntax that would feel familiar to TaskPaper users (who have been relying on similar workflows for years), while retaining the simplicity of Todoist's Quick Add panel. I've been typing lists of tasks in Bear using this syntax for about a week now, and the system is pretty natural for me at this point. It's not as clever as I'd like it to be, but I think it strikes a good balance of legibility and the customization granted by TaskPaper.
The WorkflowNow onto the good stuff. The underlying concept of my workflow is that, by the end of a repeat loop that iterates over multiple lines of text, we should end up with a JSON array containing tasks we can send to Things. This is largely made possible by Match Text actions that use regular expressions to isolate different parts of a line and assign them to different attributes of a task. At a high level, this is what the workflow does: it repeats a series of regular expressions for each line, generates JSON, and packages everything up to send data to Things in bulk.
The workflow starts by splitting input text at new lines, creating a list of lines ready for a repeat loop. You're free to choose the kind of input text you want to use: you may type lines of text directly in Workflow, get the contents of the clipboard, or use the workflow as an action extension, reading input from another app. Personally, I just copy lines of text from Drafts and use a Text action with a Clipboard variable to read whatever is in the system pasteboard. I usually run the workflow from a widget.
Once the workflow has split the text in multiple lines, it discards the empty ones with a conditional block. This is done by counting the characters contained on each line; if the count is 0, it means a line is empty and shouldn't be parsed. Lines with text in them are saved to a Lines variable that the workflow then begins to process.
Once it has at least one line of text, the workflow starts using a variety of similarly constructed regular expressions to extract task attributes. Now, I know that my regex skills are merely average, and I'm open to suggestions for improvements, but here's the general idea: using positive lookbehinds and negative lookaheads, Workflow's regex engine matches text items that are preceded by a specific character but not followed by other characters. This enables us to match a multi-word @Tag Name until it is followed by a #Project Name, for example, or a ++Note that contains a URL as long as it's not interrupted by a ==Heading. There's probably a better, more elegant way to do this, but I haven't been able to break my system yet, and it seems to get the job done.
I want to call out a few things you'll likely notice in scrolling through the Workflow. Double quotes are always escaped as \" to avoid JSON errors. The date is formatted using YYYY-MM-dd@h:mma, as required by the Things URL scheme spec. If you don't enter a time, Workflow will add 12 PM as a default time string, thus setting a reminder in Things. If you prefer to create tasks in Things for specific days but without time-based reminders, I suggest removing the @h:mma bit from the Format Date action.
Under the hood, JSON is constructed using a simple Text action that contains plain text and variables previously generated by the workflow. At the end, before launching Things, the workflow generates a complete JSON object that looks something like this:
Finally, after using the things:///add-json command, Things will launch, importing all the tasks you've passed to the app with the correct attributes and fields.
To give you an idea of how this complex automation results in just a few seconds of footage, here's a video of the workflow in action:
Replay
You can download the workflow here.
I'm having fun with Things' latest automation features. This workflow is helping me better plan the week ahead thanks to its support for batch processing tasks in the app: instead of creating one task after another in Things, slowly tapping around to select projects and dates, I can just prepare a list of formatted tasks in Drafts or Bear, hit a button, and import everything in Things. It takes two seconds to run and everything ends up in the right place.
I'm not done though. There's more I want to build for Things, such as Markdown-based templates that generate entire projects in Things. As I argued last week, Cultured Code has created a versatile URL scheme that, in addition to developers, can be used by tinkerers and power users to extend Things in powerful, fun new ways.
If you have ideas on how to improve this workflow, let me know on Twitter. And in case you haven't played with it yet, you can read more about Things automation here.
Top 10 Best Python Libraries For Natural Language Processing In 2024
We independently select all products and services. This article was written by a third-party company. If you click through links we provide, The Georgia Straight may earn a commission. Learn more
Python is a widely used programming language, often favored in the field of data science, and its uses go beyond to include natural language processing (NLP). NLP is concerned with analyzing and understanding human language, and this task is made much easier with the support of Python libraries. This piece will explore some of the Python libraries that are particularly beneficial for natural language processing.
One of the most popular libraries for NLP is Natural Language Toolkit (NLTK). It is widely considered the best Python library for NLP and is an essential tool for tasks like classification, tagging, stemming, parsing, and semantic reasoning. NLTK is often chosen by beginners looking to get involved in the fields of NLP and machine learning. Another popular library is spaCy, which is recognized as a professional-grade Python library for advanced NLP. It excels at working with incredibly large-scale information extraction tasks.
Understanding Natural Language ProcessingNatural Language Processing (NLP) is a branch of Artificial Intelligence (AI) that focuses on enabling computers to understand, interpret, and generate human language. It involves the use of algorithms and statistical models to analyze and extract meaning from natural language data, including text and speech.
NLP is a rapidly growing field with numerous applications in various industries, including healthcare, finance, customer service, and marketing. Some of the common tasks in NLP include sentiment analysis, language translation, speech recognition, and text summarization.
To perform these tasks, NLP relies on a combination of rule-based and statistical approaches. Rule-based methods involve the use of predefined rules and patterns to process and analyze language data. Statistical methods, on the other hand, use machine learning algorithms to learn patterns and relationships from large datasets.
Python is a popular language for NLP due to its simplicity, flexibility, and the availability of numerous libraries and frameworks. Some of the popular Python libraries for NLP include Natural Language Toolkit (NLTK), spaCy, TextBlob, Gensim, and CoreNLP.
Overall, understanding NLP is essential for anyone interested in working with natural language data. With the right tools and techniques, it is possible to extract valuable insights and knowledge from language data that can be used to improve decision-making and drive business growth.
Python and Natural Language ProcessingPython is a popular programming language that has become a go-to tool for natural language processing (NLP). NLP is a field of study that focuses on the interactions between computers and humans in natural language. It involves analyzing, understanding, and generating human language with the help of algorithms and computational methods.
Python has a wide range of libraries that can be used for NLP tasks. These libraries provide a wide range of capabilities, including text processing, sentiment analysis, machine translation, and more. Some of the most popular Python libraries for NLP are:
Python's ease of use and the availability of powerful libraries make it an ideal choice for NLP tasks. With the right tools and techniques, developers can build powerful applications that can analyze and understand human language.
Best Python Libraries for Natural Language ProcessingPython is one of the most popular programming languages for Natural Language Processing (NLP) tasks. With its vast collection of libraries, Python offers a wide range of tools for NLP. In this section, we will discuss the top 10 Python libraries for NLP.
1. Natural Language Toolkit (NLTK)NLTK is widely considered the best Python library for NLP. It is an essential library that supports tasks like classification, tagging, stemming, parsing, and semantic reasoning. NLTK is suitable for all kinds of programmers, including students, educators, engineers, researchers, and industry professionals.
2. SpaCyspaCy is a free and open-source library that offers a lot of built-in capabilities for NLP. It is becoming increasingly popular for processing and analyzing data in the field of NLP. SpaCy is suitable for both beginners and advanced users.
3. GensimGensim is a Python library that specializes in topic modeling and similarity detection. It is easy to use and offers a wide range of functionalities for NLP tasks.
4. CoreNLPCoreNLP is a library developed by Stanford University that offers a suite of natural language processing tools. It is written in Java but can be used in Python through the Py4J library.
5. PatternPattern is a Python library that offers a wide range of functionalities for NLP tasks, including sentiment analysis, part-of-speech tagging, and word inflection. It is suitable for both beginners and advanced users.
6. TextBlobTextBlob is a Python library that offers a simple API for common NLP tasks, including sentiment analysis, part-of-speech tagging, and noun phrase extraction. It is suitable for beginners who want to get started with NLP.
7. PyNLPIPyNLPI is a Python library that offers a wide range of functionalities for NLP tasks, including named entity recognition, sentiment analysis, and text classification. It is suitable for both beginners and advanced users.
8. Scikit-learnscikit-learn is a Python library that offers a wide range of functionalities for machine learning tasks, including NLP tasks. It is suitable for advanced users who want to build custom models for NLP tasks.
9. PolyglotPolyglot is a Python library that offers support for over 130 languages. It offers a wide range of functionalities for NLP tasks, including named entity recognition, sentiment analysis, and part-of-speech tagging.
10. PyTorchPyTorch is a Python library that offers a wide range of functionalities for deep learning tasks, including NLP tasks. It is suitable for advanced users who want to build custom deep learning models for NLP tasks.
In conclusion, Python offers a wide range of libraries for NLP tasks. The libraries discussed in this section are some of the best Python libraries for NLP, and they offer a wide range of functionalities for NLP tasks.
Comparing Python NLP LibrariesWhen it comes to Natural Language Processing (NLP) in Python, there are several libraries available to choose from. In this section, we will compare some of the most popular NLP libraries in terms of ease of use, functionality, community support, and performance.
Ease of UseOne of the most important factors to consider when choosing an NLP library is its ease of use. Libraries that are easy to use can help developers save time and effort.
NLTK is a popular library for beginners, as it provides a lot of documentation and tutorials. SpaCy is also a user-friendly library that offers pre-trained models and easy-to-use APIs. TextBlob is another library that is known for its simplicity and ease of use.
FunctionalityThe functionality of an NLP library is another key factor to consider. Libraries that offer a wide range of functionalities can help developers solve complex NLP problems.
spaCy is known for its high-performance and advanced features, such as named entity recognition and dependency parsing. NLTK also offers a wide range of functionalities, including sentiment analysis, part-of-speech tagging, and text classification. Gensim is a library that is specifically designed for topic modeling and document similarity analysis.
Community SupportCommunity support is crucial when it comes to NLP libraries. Developers need to know that they can rely on the community for help and support.
NLTK has a large and active community, which provides support through forums, mailing lists, and social media. SpaCy also has a growing community, with active contributors and support forums. TextBlob is a smaller library, but it has an active community that provides support through GitHub and Stack Overflow.
PerformanceThe performance of an NLP library can have a significant impact on the speed and accuracy of NLP applications.
spaCy is known for its high-performance and speed, making it a popular choice for large-scale NLP applications. NLTK is also a high-performance library, but it can be slower than spaCy for some tasks. Gensim is designed for scalability and high-performance, making it a popular choice for large-scale topic modeling.
In summary, when choosing an NLP library, developers should consider factors such as ease of use, functionality, community support, and performance. Each library has its own strengths and weaknesses, and the choice ultimately depends on the specific needs of the project.
Choosing the Right Python Library for NLPWhen it comes to Natural Language Processing, choosing the right Python library can be a daunting task. With so many options available, it's essential to consider your specific needs and requirements before selecting a library.
One of the most popular libraries for NLP is the Natural Language Toolkit (NLTK). It is widely considered to be the best Python library for NLP and is an essential tool for beginners looking to get involved in the field of NLP and machine learning. NLTK supports a variety of tasks, including classification, tagging, stemming, parsing, and semantic reasoning.
Another popular library is spaCy, which is known for its speed and efficiency. It is an excellent choice for large-scale NLP projects and is particularly useful for tasks such as named entity recognition and dependency parsing.
Gensim is another library worth considering, especially if your project involves topic modeling or word embeddings. It is a robust and efficient library that supports a wide range of NLP tasks, including document similarity and text summarization.
In addition to these libraries, there are several other options available, including TextBlob and CoreNLP. TextBlob is a simple and easy-to-use library that is ideal for beginners, while CoreNLP is a more advanced library that supports a wide range of NLP tasks, including sentiment analysis and part-of-speech tagging.
Ultimately, the right Python library for your NLP project will depend on your specific needs and requirements. It's essential to consider factors such as the size and complexity of your project, your level of experience with NLP, and the specific tasks you need to perform. By carefully evaluating your options and selecting the right library, you can ensure that your NLP project is a success.
ConclusionNatural Language Processing is a vast field that requires the use of specialized tools to process and analyze text data. Python has emerged as the go-to language for NLP due to its simplicity, versatility, and the availability of several powerful libraries.
In this article, we have explored some of the best Python libraries for Natural Language Processing. These libraries provide a wide range of functionalities, including tokenization, stemming, part-of-speech tagging, parsing, and semantic reasoning.
NLTK is widely considered the best Python library for NLP and is often chosen by beginners looking to get involved in the field. SpaCy is another popular library that excels at working with large-scale information extraction tasks. Other libraries like TextBlob, Gensim, and Pattern offer unique functionalities and can be used for specific NLP tasks.
It is important to note that the selection of a library depends on the specific requirements of the project. Therefore, it is recommended to explore the features of each library and choose the one that best suits the project's needs.
Overall, Python has a vibrant NLP community, and these libraries are a testament to the language's power and flexibility. With the help of these libraries, developers can build sophisticated NLP applications that can understand human language and provide valuable insights.
Frequently Asked Questions What are some popular open-source NLP libraries in Python?Python has a wide range of open-source NLP libraries, including Natural Language Toolkit (NLTK), spaCy, TextBlob, Gensim, Pattern, and Stanford NLP. These libraries provide a range of functionalities, from tokenization and parsing to sentiment analysis and topic modeling.
Which Python library is widely considered the most comprehensive for NLP?NLTK is widely considered the most comprehensive Python library for NLP. It is an essential library that supports tasks like classification, tagging, stemming, parsing, and semantic reasoning. It also provides a range of datasets and resources that can be used for training and testing NLP models.
Are there any free Python libraries for NLP?Yes, there are several free and open-source Python libraries for NLP, including NLTK, spaCy, TextBlob, and Gensim. These libraries can be easily installed using pip and provide a range of functionalities for NLP tasks.
What are some advantages of using NLTK for NLP?NLTK has several advantages for NLP, including its comprehensive set of tools and resources, its user-friendly interface, and its active community of developers and users. It also provides a range of datasets and resources that can be used for training and testing NLP models.
Can Python be used for advanced NLP tasks?Yes, Python can be used for advanced NLP tasks, including sentiment analysis, named entity recognition, and topic modeling. Python libraries like NLTK, spaCy, and Gensim provide a range of functionalities for these tasks and can be easily integrated into NLP pipelines.
What are some examples of NLP applications that can be developed using Python libraries?Python libraries can be used to develop a range of NLP applications, including chatbots, sentiment analysis tools, text summarization tools, and recommendation systems. These applications can be used in a range of industries, from e-commerce to healthcare to finance.
Horizon Calendar 2.0 Adds Natural Language Parsing, Check The Weather Integration
Back in February, I covered Horizon Calendar, an app developed by Kyle Rosenbluth that cleverly combined the classic aspects of a calendar with basic weather information:
The core aspect of Horizon is how it mixes weather with event information. When creating a new event, the app uses Google location data (which I found to be the best provider here in Italy) to show a list of suggestions in a bar above the keyboard; once you've chosen a location, Horizon will fetch a weather forecast (up to 14 days out). The app was created for people who deal with appointments in multiple locations on a daily basis: by entering a single day's view, you'll see a list of all your upcoming events alongside their respective locations and weather forecasts.
Horizon Calendar 2.0, released today, is a solid update that adds powerful functionality without sacrificing the app's usability and ease of use. Following a trend established by apps like Fantastical and Due, Horizon now comes with natural language parsing for event creation: type something like "Skype call on Monday 5 PM until 7" and Horizon will correctly understand and parse your input automatically filling the necessary calendar fields for you.1
Due and Fantastical have been praised for how they handle visual feedback during event creation, and Horizon follows a similar path by coloring the various pieces of information it parses in your commands. Locations will be highlighted in green, time in blue, event names in black, and prepositions in light gray. It's not as immediate as Fantastical, but it's a great touch. Horizon's Google-based automatic completion – a feature I also mentioned in 1.0 – helps in adding new events as well.
Alongside a new icon (designed by the Iconfactory), more weather information, and a landscape year view, Horizon 2.0 comes with Check the Weather integration for forecasts. The way this works is nice: if you have David Smith's app installed2, a weather icon next to each event will let you quickly jump to Check the Weather to get a weather forecast for the location of the event. Check the Weather will display a "Via Horizon" label at the top and let you return to the app as well. This is a good implementation of app callbacks to let the user get more data; I'd love to see more third-party weather apps supported in the future.
Horizon Calendar does one thing well and this new version is a good update. There's still room for improvement, but, like I said in my original review, I highly recommend Horizon to people who want to see calendar and weather information in a single screen.
Comments
Post a Comment