aboutsummaryrefslogtreecommitdiff
path: root/src/ellinika/aorist.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-04 10:27:59 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2011-06-04 10:27:59 +0000
commitceb837f01112d2cfde96ba9e6ddc9c9ccbd0d0a4 (patch)
tree316933c27051392c5cd48b873ae0697cd389d52a /src/ellinika/aorist.c
parent99076de629a6f5f2b654118cde3612f9ba05edf0 (diff)
downloadellinika-ceb837f01112d2cfde96ba9e6ddc9c9ccbd0d0a4.tar.gz
ellinika-ceb837f01112d2cfde96ba9e6ddc9c9ccbd0d0a4.tar.bz2
Implement new morphological functions. Move elmorph to scm/ellinika
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@554 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'src/ellinika/aorist.c')
-rw-r--r--src/ellinika/aorist.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/ellinika/aorist.c b/src/ellinika/aorist.c
new file mode 100644
index 0000000..995fce8
--- /dev/null
+++ b/src/ellinika/aorist.c
@@ -0,0 +1,73 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <errno.h>
+#include <stdlib.h>
+#include <libguile.h>
+#include "utf8.h"
+#include "elmorph.h"
+
+int
+elmorph_thema_aoristoy(unsigned *word, size_t len,
+ unsigned **thema, size_t *tlen)
+{
+ unsigned ch, *pw;
+
+ switch (word[len-1]) {
+ case 0x03B6: /* ζ */
+ /* FIXME: This can produce ξ as well: αλλάζω => άλλαξα */
+ case 0x03B8: /* θ */
+ ch = 0x03C3; /* σ */
+ break;
+
+ case 0x03B3: /* γ */
+ case 0x03C7: /* χ */
+ ch = 0x03BE; /* ξ */
+ break;
+
+ case 0x03BA: /* κ */
+ if (len > 1 && word[len-2] == 0x03C3 /* σκ */)
+ len--;
+ ch = 0x03BE; /* ξ */
+ break;
+
+ case 0x03BD: /* ν */
+ if (len > 1 && word[len-2] == 0x03C7 /* χν */) {
+ len--;
+ ch = 0x03BE; /* ξ */
+ } else
+ ch = 0x03C3; /* σ */
+ break;
+
+ case 0x03B2: /* β */
+ case 0x03C0: /* π */
+ case 0x03C6: /* φ */
+ ch = 0x03C8; /* ψ */
+ break;
+
+ case 0x03CD: /* ύ */
+ case 0x03C5: /* υ FIXME: This assumes the word has been deaccentized */
+ if (len > 1 && (word[len-2] == 0x03B1 /* αύ */ ||
+ word[len-2] == 0x03B5 /* εύ */)) {
+ ch = 0x03C8; /* ψ */
+ break;
+ }
+
+ default:
+ len++;
+ ch = 0x03C3; /* σ */
+ }
+
+ pw = calloc(len, sizeof(pw[0]));
+ if (!pw)
+ return -1;
+ memcpy(pw, word, sizeof(word[0]) * (len - 1));
+ pw[len-1] = ch;
+
+ *thema = pw;
+ *tlen = len;
+ return 0;
+}
+
+
+

Return to:

Send suggestions and report system problems to the System administrator.