Can the LibreOffice LightProof grammar library be used externally? - python

LibreOffice 3.5 includes a grammar checker, called (or maybe based on) LightProof. From what I have read, LightProof seems to be a Python library that can be used to check for custom grammar rules. But I can not for the life of me find a project page for LightProof.
The closest I got was http://cgit.freedesktop.org/libreoffice/lightproof/tree/, which seems to be the code for the LibreOffice extension, not LightProof itself.
So is LightProof actually a library that can be implemented in other applications, or is it just a code word for a LibreOffice feature?

LightProof has been superseded by LanguageTool, the source of which is available on GitHub.

It's not possible yet, but: "we will be able to make a stand-alone version of Lightproof/Grammalecte as it won’t be necessary to use Hunspell anymore" - see Olivier R.'s post to the LibreOffice mailing list.

Related

Need source code for _xmlplus in Python

We were using Python 2.4 in our application. Now we are migrating to 2.7.8.
In our code, we had used Sax2 and xpath functionality from "_xmlplus" library.
Approach 1:
We started off by re-writing the parsing logic used in all those files (ie files where Sax2 and xpath were used), but this is a tedious job.
Approach 2:
Use _xmlplus for 2.7 version. For which we need the source code for "_xmlplus". So that we can build the library. (We were not able to find the source code in web)
Can anyone please suggest the right approach, which we should take ?
It appears that _xmlplus is a package from PyXML library, so the source is available on sourceforge. However note that PyXML is no longer maintained (last files are from 2004).

Search python docs offline?

In python I can get some rudimentary documentation for any object using help(<object>). But to be able to search the documentation, I have to go online. This isn't really helpful if I'm somewhere where the internet isn't accessible.
In R, there is a handy double question mark feature (??<topic>) that allows me to search through the documentation of all installed libraries for any function that includes <topic> in its name or documentation string. Is there anything similar for python? Perhaps even just for loaded objects?
pydoc comes with python and can do searches but only in the synopsis lines of available modules. Quoting pydoc --help:
pydoc -k
Search for a keyword in the synopsis lines of all available modules.
Note that into pydoc you can perform searches using "/".
Look in the python folder in the folder: Doc. This folder has the entire downloaded documentation of the python docs from python.org. I know this is a VERY late answer, but it brings up an easy solution.
This was mentioned in the comments already: Zeal
is similar to Dash but for Windows/Linux. It uses the same sources as Dash. It's built using Qt and is available in the repositories for several distros, for Ubuntu there is a PPA. Download it here.
Zeal is a simple offline API documentation browser inspired by Dash (OS X app), available for Linux and Windows.
Quickly search documentation using Alt+Space (or customised) hotkey to display Zeal from any place in your workspace.
Search in multiple sets of documentation at once.
Don't be dependent on your internet connection.
Integrate Zeal with Emacs, Sublime Text, or Vim. See Usage » Editor plugins for details.
It is open source (GPL), development happens on GitHub. Zeal uses the same stylesheets/HTML as the online docs, so everything should look familiar.
An in-browser alternative is devdocs.io. You can access the website even if you are offline, provided that you've marked them for local offline storage. You'll need to enable the Python 2 docs, and then mark them for offline storage here. However, as a longtime user of the online Python docs, I find the custom stylesheet that DevDocs uses a bit distracting.
Just to add another option for offline access of python docs (mostly core):
I don't have access to a linux computer at the moment, but on windows, you can navigate to your_python_dist_folder/doc to find some help files. Particularly python275.chm for instance.
If there's no doc folder on your linux machine, you can download the file here and google for a linux chm viewer:
https://www.google.com/search?q=linux+chm+viewer
::Note:
Some distributions also include docs for other packages in there... might be worth a check. Other than that, help(module) usually returns good information.
Edit:
You could get something that might be a little closer to what you want by using pydoc. E.g. you are looking for something about sin in the math module:
import math
import pydoc
[i for i in dir(math) if 'sin' in pydoc.getdoc(getattr(math,i))]
This would return the methods whose docstrings include sin:
['acos', 'acosh', 'asin', 'asinh', 'cos', 'cosh', 'isinf', 'sin', 'sinh']
for which you then could run the help() function
In case your working in a Mac there is Dash, which allows you to download docsets and then explore/search offline. Despite its documentation functionality, Dash is also a Snippet Manager.
Windows Idle - F1 from shell window or editing window gets you a windows help file of all the docs. I think it's better than the online version - it's easier to find stuff.
Although there are certainly better documentations built into your computer than help() like windows idle, another option for some of the more common topics would just be to save some of the online documentation to your computer. For the modules you use a lot and want to access offline, you could just download a text file version of the official online python documentation, which is the best place to get documentation. (file > save page as > select .txt file format)
This may not have been available at the time the question asked and answered, but python.org now makes all the documentation available online as an archive of HTML files which can be navigated and searched offline: https://docs.python.org/2/download.html
(The link directs to docs for the latest version of 2.x, but you can choose 3.x and older 2.x versions from that page)
You should try ipython.
object_name? will print all sorts of details about any object,
including docstrings, function definition lines (for call arguments)
and constructor details for classes.
The magic commands %pdoc, %pdef, %psource and %pfile will respectively print the docstring, function definition line, full source code and the complete file for any object (when they can be found). If automagic is on (it is by default), you don’t need to type the ‘%’ explicitly.

writing an api for python that can be installed using setup.py method

I am new at writing APIs in python, in any language for that matter. I was hoping to get pointers on how i can create an API that can be installed using setup.py method and used in other python projects. Something similar to the twitterapi.
I have already created and coded all the methods i want to include in the API. I just need to know how to implement the installation so other can use my code to leverage ideas they may have. Or if i need to format the code a certain way to facilitate installation.
I learn best with examples or tutorials.
Thanks so much.
It's worth noting that this part of python is undergoing some changes right now. It's all a bit messy. The most current overview I know of is the Hitchhiker's Guide to Packaging: http://guide.python-distribute.org/
The current state of packaging section is important: http://guide.python-distribute.org/introduction.html#current-state-of-packaging
The python packaging world is a mess (like poswald said). Here's a brief overview along with a bunch of pointers. Your basic problem (using setup.py etc.) is solved by reading the distutils guide which msw has mentioned in his comment.
Now for the dirt. The basic infrastructure of the distribution modules which is in the Python standard library is distutils referred to above. It's limited in some ways and so a series of extensions was written on top of it called setuptools. Setuptools along with actually increasing the functionality provided a command line "installer" called "easy_install".
Setuptools maintenance was not too great and so it was forked and a more active branch called "distribute" was setup and it is the preferred alternative right now. In addition to this, a replacement for easy_install named pip was created which was more modular and useful.
Now there's a huge project going which attempts to fold in all changes from distribute and stuff into a unified library that will go into the stdlib. It's tentatively called "distutils2".

Detailed explanation about Python's "freeze"

Is there anywhere a detailed explanation about Python's "freeze" thing? I saw the PyPi page, but I don't think it's comprehensive enough.
There is documentation about freeze on the wiki and the source docstring is pretty good.. There is an alternative, cx_Freeze. For windows there is py2exe. For Macs, py2app.
Unless you are trying to make a single-download type program for windows, it is often easier to rely on eggs or source packages installed via setup.py/setuptools/distribute/pip.

Has anyone found a good set of python plugins for vim -- specifically module completion?

I'm looking for a suite of plugins that can help me finally switch over to vim full-time.
Right now I'm using Komodo with some good success, but their vim bindings have enough little errors that I'm tired of it.
What I do love in Komodo, though, is the code completion. So, here's what I'm looking for (ordered by importance).
Code completion, meaning: the ability to code complete modules/functions/etc. in any module that's on the pythonpath, not just system modules. Bonus points for showing docstrings when completing.
Jump-to a class definition. I'm guessing CTAGS will do this, so how do you all manage automatically updating your tags files?
Project type management for managing buffers: ideally the ability to grep for a filename in a directory structure to open it. Bonus for showing an index of class definitions while a buffer is open.
Bzr integration. Not super important, since most of it I can just drop to the shell to do.
Here you can find some info about this.
It covers code completion, having a list of classes and functions in open files. I haven't got around to do a full configuration for vim, since I don't use Python primarily, but I have the same interests in transforming vim in a better Python IDE.
Edit: The original site is down, so found it saved on the web archive.
And I write another plugin: https://github.com/klen/python-mode
Old (now its more powerful) screencast here: https://www.youtube.com/watch?v=67OZNp9Z0CQ
Old question, but I typed all this up for a misread question...
General plugin recommendations: LookupFile and a plugin for your source control system (I like Git and Git-Vim).
Python plugin recommendations: If you're using Linux, I'd recommend ipython and ipy.py (a better interactive interpreter). Improved syntax highlighting, snippets, pydoc, and for refactoring support bicyclerepairman. I got started with this post.
You may want to try looking through someone's vimfiles. Mine are on github.
For refactoring: ropevim
Here is some info on Bazaar integration if you're interested:
https://launchpad.net/bzr-vim-commands
I use pydoc.vim (I actually wrote it) a lot, try it and tell me what you think. Another one that I think is quite useful is the updated syntax file with all it's extensions that you can enable, which you can find here.
I use Pydiction (http://www.vim.org/scripts/script.php?script_id=850) it's a plugin for vim that lets you Tab-complete python modules/methods/attributes/keywords, including 3rd party stuff like Pygame, wxPython, Twisted, and literally everything. It works more accurately than other things i've tried and it doesn't even require that python support be compiled into your Vim.
Code completion: PySmell looks promising. It's work-in-progress, but alredy useful.
I personally thinkJedi Vim is the best, but it is incompatible with python-mode.

Categories

Resources