LISP, lingual analysis and multiple object references
In a meantime I think about a knowledge database creation, which could work like a long-term memory.
I want to parse a text and build a weighted graph of words (actually their roots only) connected into sentences or lingual blocks. The first task I want to complete is a simple replacement of the pronouns with the appropriate nounses from the previous blocks.
But while thinking about this idea I stumbled upon a non-trivial problem with LISP and object pointers. It is a simple task to have a single object to be referenced from multiple other data structures – we can allocate memory and have pointers stored in multiple objects (I will leave object removal and reference counter problems for now).
But in LISP I basically do not know how to do this. Or more simple task: how to have the same data structure (namely LISP object) to be referenced, accessible and editable from two lists for example.
In LISP I only know how to push an object into list, but not its pointer. Here is an example:
> (defparameter *test-list* (list 1 2 3)) *TEST-LIST* > (defparameter *storage-list* (list)) *STORAGE-LIST* > (defparameter *another-list* (list)) *ANOTHER-LIST* > (push *test-list* *storage-list*) ((1 2 3)) > (push *test-list* *another-list*) ((1 2 3)) > (push "string" *test-list*) ("string" 1 2 3) > *storage-list* ((1 2 3)) > *another-list* ((1 2 3))
I added *test-list* into *storage-list* and *another-list*, but actually I added its copy, since added object modification was not represented in the destination storages.
With object it is a bit simple – we do can modify it in-place, but still I do not know how to make it being referenced from multiple storages (like lists).
And thus I do not know how to implement a weighted graph, where each word is supposed to be linked and referenced to/from multiple other words. Plus each object should be accessible from the indexed data structure (like hash table or tree) for fast access.
Any ideas how to implement multiple references in LISP? I can switch to some other language of course, but I like idea to make this in LISP :)