Alexey Semenoff > Sdict > Sdict

Download:
Sdict-3.0.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 3.0   Source  

NAME ^

Sdict - Module to work with Sdictionary .dct files

SYNOPSIS ^

        use Sdict;


    # File compilation/decompilation
        $Sdict::debug = 1;

        $sd = Sdict->new;

        $sd->parse_args;

        $sd->analyze;

        $sd->convert;

        exit;


    # Working with .dct
        $sd = Sdict->new;

        $sd->debug_on; # or $sd->debug_off;

        $sd->init ( { file => 'test.dct' } );

    # Load dictionary
        unless ($sd->load_dictionary_fast) {
            die 'Unable load dictionary';
        }


    # Locate word
        my $article = $sd->search_word ('fox');
        print "translation is '$article'\n" if $article;


    # Unload dictionary
        $sd->unload_dictionary;


    # If you are interested about header only
        unless ($sd->read_header) {
            die 'Unable to load dictionary';
            next;
        }

        warn "found '$sd->{header}->{title}'";


    # Information about dictionary
        $title = $sd->{header}->{title};
        $copyright = $sd->{header}->{copyright};
        $word_lang = $sd->{header}->{w_lang};
        $article_lang = $sd->{header}->{a_lang};
        $version = $sd->{header}->{version};
        $words_total = $sd->{header}->{words_total};


    # Print info
        $sd->print_dct_info;



    # Get words from current position
        for (my $i=0; $i < SDICT_LOAD_ITEMS; $i++) {

                $word = $sd->get_next_word;
                $word = decode ("utf8", $word);

                last if ($curWord eq q{}); # Last word reached

                warn "word '$word'";

                ...
        }

        $pos = $sd->{f_index_pos_cur};


    # Get previous word
        $word = $sd->get_prev_word;


    # Get article you stay on
        $article = $sd->read_unit($sd->{cur_word_pos} + $sd->{articles_pos});

AUTHOR ^

The Sdict module was written by Alexey Semenoff, swaj@swaj.net as part of Sdictionary project. The project homepage is http://freshmeat.net/projects/sdictionary/.

MODIFICATION HISTORY ^

See the Changes file.

syntax highlighting: