<commit_before># -*- coding: utf-8 -*-

import os.path
import sys

class Citation(object):

    @staticmethod
    def connect():

        """
        Returns source from builder,
        printing any errors from python to the vim console.
        """

        try:
            set_script_path()
            from citation_vim.builder import Builder
            from citation_vim.loader import Loader
            return Builder(Loader().context).build_source()
        except:
            print_exception()

def set_script_path():
    script_path = os.path.join(vim.eval('s:script_path'), '../../../python')
    sys.path.insert(0, script_path)

def print_exception():
    import traceback
    exc_type, exc_value, exc_traceback = sys.exc_info()
    lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
    print("Citation.vim error:\n" + "".join(line for line in lines))
<commit_msg>add explicit vim module import for neovim support<commit_after># -*- coding: utf-8 -*-

import os.path
import sys
import vim

class Citation(object):

    @staticmethod
    def connect():

        """
        Returns source from builder,
        printing any errors from python to the vim console.
        """

        try:
            set_script_path()
            from citation_vim.builder import Builder
            from citation_vim.loader import Loader
            return Builder(Loader().context).build_source()
        except:
            print_exception()

def set_script_path():
    script_path = os.path.join(vim.eval('s:script_path'), '../../../python')
    sys.path.insert(0, script_path)

def print_exception():
    import traceback
    exc_type, exc_value, exc_traceback = sys.exc_info()
    lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
    print("Citation.vim error:\n" + "".join(line for line in lines))

{'fraction_non_alphanumeric': 0.11165311653116532, 'fraction_numerical': 0.002168021680216802, 'mean_word_length': 2.619607843137255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3374405', 'n_tokens_mistral': 543, 'n_tokens_neox': 526, 'n_words': 139}