CVS edit link for arlmedia

We submit the BDIC Module. BDIC - short for Beuth-Dictionary - is a Dictionary-Infrastructure. It was specifically developed as bilingual dictionary as a teaching infrastructure within www.mediencommunity.de

Developement of BDIC was sponsored by Beuth-University Berlin, the German Federal Ministry for Education and Research and European Social fund.

We have developed BDIC as a news module from the scratch. BDIC is built around a fault tolerant customized search algorithm based on both lexical and phonological search.

Phonological classification was built on the free Soundex-algorithm.

This search provides useful results even for orthografically insecure users. BDICS drupal permissions support roles such as admin, user and teacher. Teacher role allows definition and export of specific lists from the lexical body for each subscribing teacher.

BDIC was developed in close cooperation with mediencommunity.de. Developement was provided within a commercial service contract by Karlheinz Schuler, Arlmedia, Stuttgart (www.arlmedia.eu)

BDIC provides these features:

1. Phonological search based on the soundex algorithm: even for typographical errors or inaccurate entries at least phonologically similar references will be displayed.
2. "AutoComplete" feature for entering the search into the search
3. Role "Guest" can use the dictionary
4. Role "BDIC admin" can manage the dictionary and create new fields and lemmata
5. Role "BDIC teacher" can select and export word lists.
6. A list of "fields" should be able to disambiguate identical lemmata or lexical translations.
7. Translations will be displayed as Drupal nodes. Comments allow community review for translations.
8. The bdic module interacts properly with Durpal Core (Content, content type, blocks, menus, breadcrumb etc)

Special emphasis is on scalability of the algorithm. With thousands of community members, the search algorithms have to economize processor load. Tiered phonological search has been optimized for that purpose.The phonological search is enabled only if no other matches are available.

BDIC hosted and made available for demonstrations or download with a set of test-data on http://beuth.arlmedia.com/bdic

The sponsors want to donate the project to the Drupal community. Integration of maintenance efforts within the Drupal Developement framework was a requirement. Drupal coding Standards have been observed. It is specifically designed to interact properly with a standard Drupal 6.x environment. BDIC will support Dictionary developement in teaching environments.

BDIC will be published as a Drupal E-learning project during the DeLFI-meeting in Duisburg both by Beuth-University in berlin and arlmedia:

http://interaktive-kulturen.de

The paper has been submitted to the conference.

Please address further questions about the project to

Dipl. Biol. Karlheinz Schuler
Libanonstraße 85
D-70186 Stuttgart

fon: 0711-50 622 624
fax: 0711-96 99 26 94

office@arlmedia.eu

CommentFileSizeAuthor
#1 bdic.zip28.31 KBarlmedia

Comments

arlmedia’s picture

Title: arlmedia [arlmedia] » BDIC - Dictionary Infrastructure
StatusFileSize
new28.31 KB
avpaderno’s picture

Title: BDIC - Dictionary Infrastructure » arlmedia [arlmedia]
Status: Postponed (maintainer needs more info) » Needs work
Issue tags: +Module review

Hello, and thanks for applying for a CVS account.

May you report the difference between the proposed module, and http://drupal.org/project/dictionary, http://drupal.org/node/43612?

sun’s picture

arlmedia’s picture

Status: Needs review » Needs work

The most important differences to the dictionary module are:

1. Phonetic search based on the soundex algorithm: even for typographical errors or inaccurate entries at least phonologically similar references will be displayed.
2. "AutoComplete" feature for entering the search into the search
3. Teacher function allows personalized lists and list-export for users with teachert permission
4. A list of "fields" should be able to disambiguate identical lemmata or identical lexical translations (homonyms).
5. Tiered search algorithm: The phonological search is enabled only if no other matches are available. This should economize processor load.
6. List import function: Dictionaries can be imported using a cvs -import file
7. Ajax features increase usability e.g. while selecting the individual teachers list from the BDIC.

The combination of features 1, 3, 5, 6 made a new developement necessary. The phonetic search was not yet available for Drupal. But it was specifically required in a teaching environment because it allows a retrieval of a requested word that is tolerant against typos.

avpaderno’s picture

Status: Needs work » Needs review

Thanks for your reply.

avpaderno’s picture

  1. See the coding standards (http://drupal.org/coding-standards) to understand how a module should be written. In particular, see how the code should be formatted; how functions, constants, and Drupal variables declared from the module should be named; which Unicode functions a module should be using.
  2.   require_once('bdic.module');
    

    require_once() would try to load the module file from the current directory, which the Drupal root directory, not the directory containing the module. There is a Drupal function that should be used to load a module, in cases like this.

    For the same reason, require_once('bdic.admin.inc'); doesn't work too. Also in this case, there is a specific Drupal function to use.
    It's then bad design to split code in two different files, when the second file is always included from the first. In such cases, it is better to merge files, or change which functions are including in the first file, and in the second file.
    To include the module file from bdic.admin.inc is useless; the module file is already loaded, when bdic.admin.inc will be loaded.

  3.   $sql = "select * from {role} where name = 'bdic teacher'";
      $res = db_query($sql, array());
      //if it does not exist, then create it
      $arr = db_fetch_array($res);
      if ($arr === FALSE) {
        $params = array('bdic teacher');
        $sql = "insert into {role} (name) values ('%s')";
        db_query($sql, $params);
    

    SQL reserved words must be written in uppercase letters.
    If you are checking if an entry exists, then the code should be like the following:

      if (!db_result(db_query("SELECT 1 from {role} where NAME = 'bdic teacher'")) {
        $params = array('bdic teacher');
        $sql = "INSERT INTO {role} (name) VALUES ('%s')";
        db_query($sql, $params);
    
  4.   $items['admin/content/bdic/entry/add'] = array(
        'title' => 'Add word',
        'description' => 'Add one entry and translations to the dictionary.',
        'page callback' => 'bdic_add_lemma',
        'page arguments' => array(),
        'access arguments' => array('administer bdic'),
        'type' =>  MENU_LOCAL_TASK | MENU_VISIBLE_IN_BREADCRUMB,
        'file' => 'bdic.admin.inc',
        'parent' => 'admin/content/bdic'
      );
    
      // show all fields in the table next to a delete, edit link
      // show an add field add the end of the page
      // in the case of deletion show a warning regarding the affected rows
      $items['admin/content/bdic/fields'] = array(
        'title' => 'Fields',
        'description' => 'Edit fields as classifiers for bdic translations.',
        'page callback' => 'bdic_show_fields',
        'page arguments' => array(),
        'access arguments' => array('administer bdic'),
        'type' => MENU_DEFAULT_LOCAL_TASK | MENU_LOCAL_TASK | MENU_VISIBLE_IN_BREADCRUMB,
        'weight' => -9,
      'file' => 'bdic.admin.inc',
      'parent' => 'admin/content/bdic'
      );
      $items['admin/content/bdic/fields/edit/%'] = array(
       'title' => 'Edit the field',
       'page callback' => 'bdic_edit_field',
       'file' => 'bdic.admin.inc',
       'page arguments' => array(5),
       'access arguments' => array('administer bdic'),
       'type' => MENU_CALLBACK | MENU_DEFAULT_LOCAL_TASK,
       'parent' => 'admin/content/bdic/fields'
    
      );
    
    • MENU_DEFAULT_LOCAL_TASK, and MENU_LOCAL_TASK are mutually exclusive, as are MENU_DEFAULT_LOCAL_TASK, and MENU_CALLBACK.
    • MENU_VISIBLE_IN_BREADCRUMB is never used in menu callbacks definition; the fact the constant is not explained makes me think it's internally used by Drupal, but it should not be used by third-party modules.
    • Other menu callbacks are not correctly defined; menu callbacks of type MENU_LOCAL_TASK require a menu callback of type MENU_DEFAULT_LOCAL_TASK.

    To understand better how menu callbacks are defined, see each implementation of hook_menu.

  5. /**
     * Implements hook_access
     */
    
     function bdic_access($op, $node, $account) {
      switch ($op) {
        case "create":
          return user_access('administer bdic');
          break;
        case "delete":
          return user_access('administer bdic');
          break;
        case "update":
          return user_access('administer bdic');
          break;
        case "view":
          return user_access('access bdic');
          break;
      }
     }
    

    The code is not using the correct permissions. Permission to update a content type is given to users who has permission to update the content type of that node, not to whom has permission to administer that content type.
    See hook_access(), and forum_access().

  6. function bdic_autocomplete($string) {
      header('content-type: text/html; charset: utf-8');
      if (strlen($string)<2) {
        print drupal_to_js(array());
      }
      else {
        $matches = array();
        $result = db_query_range("SELECT distinct word from {bdic_lemma} WHERE Lower(word) LIKE Lower('%s%%')", $string, 0, 20);
        while ($lemma = db_fetch_object($result)) {
          $matches[] = check_plain($lemma->word);
        }
        $result = db_query_range("SELECT distinct translation from {bdic_translations} WHERE Lower(translation) LIKE Lower('%s%%')", $string, 0, 20);
        while ($translation = db_fetch_object($result)) {
          $matches[] = check_plain($translation->translation);
        }
        // sort matches and remove the doubles
        sort($matches, SORT_STRING);
        $matches2 = array();
        foreach ($matches as $m) {
          if (!array_key_exists($m, $matches2)) {
            $matches2[$m] = $m;
          }
        }
    
        drupal_json($matches2);
      }
    }
    
    • Autocomplete callbacks don't set the content type.
    • The coding standards report which Unicode string functions should be used.
    • For queries using DISTINCT, there is a Drupal function (db_distinct_field()).
  7.   header('Content-type: application/txt');
      header('Content-Disposition: attachment; filename="my_dictionary.txt"');
    

    Drupal has the function drupal_set_header().

  8. Permissions are in the form <ver> <object>, not <noun> <noun>.
  9. In all the strings appearing in the user interface you should be using BDIC, as it's an acronym.
  10. /**
     * Implements menu_alter hook
     */
    

    The correct comment is

    /**
     * Implements hook_menu_alter().
     */
    
avpaderno’s picture

Status: Needs work » Closed (won't fix)

I am closing this application due to lack of replies.

arlmedia’s picture

Status: Closed (won't fix) » Needs work

Hello Kiamlaluno, thank you very much for your very instructive detailed review of our code. You have provided very valuable advice. We appreciate your input and will evaluate and fix that as soon as possible. BDIC is already in use on a production environment on http://mediencommunity.de/bdic. An updated version of BDIC should follow soon.

brianV’s picture

Status: Needs work » Closed (won't fix)

When a fixed version of your module is ready, please re-apply fresh.

Re-closing.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes

Please read the following links as this is very important information about CVS applications.