All Projects → yuce → Pyswip

yuce / Pyswip

Licence: mit
PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.

Programming Languages

python
139335 projects - #7 most used programming language
prolog
421 projects

Projects that are alternatives of or similar to Pyswip

Ai Deadlines
⏰ AI conference deadline countdowns
Stars: ✭ 3,852 (+1295.65%)
Mutual labels:  artificial-intelligence, robotics, natural-language-processing
Aidl kb
A Knowledge Base for the FB Group Artificial Intelligence and Deep Learning (AIDL)
Stars: ✭ 219 (-20.65%)
Mutual labels:  artificial-intelligence, natural-language-processing
Aind Nlp
Coding exercises for the Natural Language Processing concentration, part of Udacity's AIND program.
Stars: ✭ 202 (-26.81%)
Mutual labels:  artificial-intelligence, natural-language-processing
Prodigy Recipes
🍳 Recipes for the Prodigy, our fully scriptable annotation tool
Stars: ✭ 229 (-17.03%)
Mutual labels:  artificial-intelligence, natural-language-processing
Deepinterests
深度有趣
Stars: ✭ 2,232 (+708.7%)
Mutual labels:  artificial-intelligence, natural-language-processing
Pyss3
A Python package implementing a new machine learning model for text classification with visualization tools for Explainable AI
Stars: ✭ 191 (-30.8%)
Mutual labels:  artificial-intelligence, natural-language-processing
Catalyst
🚀 Catalyst is a C# Natural Language Processing library built for speed. Inspired by spaCy's design, it brings pre-trained models, out-of-the box support for training word and document embeddings, and flexible entity recognition models.
Stars: ✭ 224 (-18.84%)
Mutual labels:  artificial-intelligence, natural-language-processing
Ai Job Info
互联网大厂面试经验
Stars: ✭ 145 (-47.46%)
Mutual labels:  artificial-intelligence, natural-language-processing
Fakenewscorpus
A dataset of millions of news articles scraped from a curated list of data sources.
Stars: ✭ 255 (-7.61%)
Mutual labels:  artificial-intelligence, natural-language-processing
Ai Job Notes
AI算法岗求职攻略(涵盖准备攻略、刷题指南、内推和AI公司清单等资料)
Stars: ✭ 3,191 (+1056.16%)
Mutual labels:  artificial-intelligence, natural-language-processing
Dreamer
Dream to Control: Learning Behaviors by Latent Imagination
Stars: ✭ 269 (-2.54%)
Mutual labels:  artificial-intelligence, robotics
Fixy
Amacımız Türkçe NLP literatüründeki birçok farklı sorunu bir arada çözebilen, eşsiz yaklaşımlar öne süren ve literatürdeki çalışmaların eksiklerini gideren open source bir yazım destekleyicisi/denetleyicisi oluşturmak. Kullanıcıların yazdıkları metinlerdeki yazım yanlışlarını derin öğrenme yaklaşımıyla çözüp aynı zamanda metinlerde anlamsal analizi de gerçekleştirerek bu bağlamda ortaya çıkan yanlışları da fark edip düzeltebilmek.
Stars: ✭ 165 (-40.22%)
Mutual labels:  artificial-intelligence, natural-language-processing
Lazynlp
Library to scrape and clean web pages to create massive datasets.
Stars: ✭ 1,985 (+619.2%)
Mutual labels:  artificial-intelligence, natural-language-processing
Thinc
🔮 A refreshing functional take on deep learning, compatible with your favorite libraries
Stars: ✭ 2,422 (+777.54%)
Mutual labels:  artificial-intelligence, natural-language-processing
Qb
QANTA Quiz Bowl AI
Stars: ✭ 153 (-44.57%)
Mutual labels:  artificial-intelligence, natural-language-processing
Ai Job Resume
AI 算法岗简历模板
Stars: ✭ 219 (-20.65%)
Mutual labels:  artificial-intelligence, natural-language-processing
Olivia
💁‍♀️Your new best friend powered by an artificial neural network
Stars: ✭ 3,114 (+1028.26%)
Mutual labels:  artificial-intelligence, natural-language-processing
Nlpaug
Data augmentation for NLP
Stars: ✭ 2,761 (+900.36%)
Mutual labels:  artificial-intelligence, natural-language-processing
Awesome Nlp Resources
This repository contains landmark research papers in Natural Language Processing that came out in this century.
Stars: ✭ 145 (-47.46%)
Mutual labels:  artificial-intelligence, natural-language-processing
Articutapi
API of Articut 中文斷詞 (兼具語意詞性標記):「斷詞」又稱「分詞」,是中文資訊處理的基礎。Articut 不用機器學習,不需資料模型,只用現代白話中文語法規則,即能達到 SIGHAN 2005 F1-measure 94% 以上,Recall 96% 以上的成績。
Stars: ✭ 252 (-8.7%)
Mutual labels:  artificial-intelligence, natural-language-processing

PySwip


The End of Python 2 Support

Python 2 has reached end of life on January 1st, 2020 as documented here. So, PySwip 0.2.10 will be the last version which officially supports Python 2.

Do you still require Python 2 support? Let us know at: https://github.com/yuce/pyswip/issues/94


What's New?

See the CHANGELOG.

This library is being cleaned up and refactored. Expect API breakage and incompatibility with previous versions.

WARNING! PySwip has no Windows installers! If you are a Windows user, see INSTALL. There are some "free download" sites that claim to be hosting PySwip installers. DO NOT TRUST THEM!

Thanks to all contributors.

Introduction

PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.

Since PySwip uses SWI-Prolog as a shared library and ctypes to access it, it doesn't require compilation to be installed.

Requirements:

  • Python 2.7 or 3.4 and higher.
    • PyPy is currently not supported.
  • SWI-Prolog 7.2.x and higher.
  • libswipl as a shared library. This is the default on most platforms.
  • Works on Linux, Windows, MacOS and FreeBSD. Should work on other POSIX.

Install

IMPORTANT: Make sure the SWI-Prolog architecture is the same as the Python architecture. If you are using a 64bit build of Python, use a 64bit build of SWI-Prolog, etc.

See INSTALL for instructions.

Examples

Using Prolog

from pyswip import Prolog
prolog = Prolog()
prolog.assertz("father(michael,john)")
prolog.assertz("father(michael,gina)")
list(prolog.query("father(michael,X)")) == [{'X': 'john'}, {'X': 'gina'}]
for soln in prolog.query("father(X,Y)"):
    print(soln["X"], "is the father of", soln["Y"])
# michael is the father of john
# michael is the father of gina

An existing knowledge base stored in a Prolog file can also be consulted, and queried. Assuming the filename "knowledge_base.pl" and the Python is being run in the same working directory, it is consulted like so:

>>> from pyswip import Prolog
>>> prolog = Prolog()
>>> prolog.consult("knowledge_base.pl")

Foreign Functions

from __future__ import print_function
from pyswip import Prolog, registerForeign

def hello(t):
    print("Hello,", t)
hello.arity = 1

registerForeign(hello)

prolog = Prolog()
prolog.assertz("father(michael,john)")
prolog.assertz("father(michael,gina)")
print(list(prolog.query("father(michael,X), hello(X)")))

Pythonic interface (Experimental)

from __future__ import print_function
from pyswip import Functor, Variable, Query, call

assertz = Functor("assertz", 1)
father = Functor("father", 2)
call(assertz(father("michael","john")))
call(assertz(father("michael","gina")))
X = Variable()

q = Query(father("michael",X))
while q.nextSolution():
    print("Hello,", X.value)
q.closeQuery()

# Outputs:
#    Hello, john
#    Hello, gina

The core functionality of Prolog.query is based on Nathan Denny's public domain prolog.py.

Help!

Projects/Publications that Use or Reference PySwip

Do you have a project, video or publication that uses/mentions PySwip? file an issue or send a pull request.

If you would like to reference PySwip in a LaTeX document, you can use the provided BibTeX file.

Books

Publications

Videos

Projects

Blog Posts

Companies using PySwip

  • Magazino GmbH Magazino develops and builds intelligent, mobile robots for intralogistics.

License

Copyright (c) 2007-2020 Yüce Tekol and PySwip contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].