-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import yaml | ||
import toml | ||
|
||
data = yaml.safe_load(open('src/yaml/adj.all.yaml')) | ||
|
||
similars = {} | ||
defs = {} | ||
members = {} | ||
ssids = [] | ||
|
||
for ssid, synset in data.items(): | ||
if synset['partOfSpeech'] == 's': | ||
similars[ssid] = synset['similar'][0] | ||
ssids.append(ssid) | ||
elif synset['partOfSpeech'] == 'a': | ||
ssids.append(ssid) | ||
defs[ssid] = synset['definition'][0] | ||
members[ssid] = synset['members'] | ||
|
||
data = {} | ||
i = 0 | ||
for ssid in ssids: | ||
if ssid not in similars: | ||
data[ssid] = {'definition': defs[ssid], 'members': ", ".join(members[ssid]) } | ||
else: | ||
data[ssid] = {'definition': defs[ssid], 'members': ", ".join(members[ssid]) , | ||
'hypernym': ", ".join(members[similars[ssid]]), | ||
'hypernym_definition': defs[similars[ssid]]} | ||
if len(data) > 1000: | ||
with open(f"adj/adj_{i}.toml", "w") as f: | ||
f.write("""# - `hypernym`: For these it must be the case that "if something is X, then it is also Y". For example, if something is moribund then it is also dying. | ||
# - `antonym`: These words have opposite meanings, they are often prefixed with 'un-' or 'dis-'. For example, if something is moral then it is not immoral. | ||
# - `pertainym`: The word means 'of or pertaining to X' and is often morphologically related. For example, if something is 'oceanic' then it is of or pertaining to the ocean. | ||
# - `scalar`: The adjective refers to a value on a scale. For example, 'hot' relates to 'temperature', 'wide' relates to 'width'. | ||
# - `quality`: This refers to an abstract noun derived from the adjective, often by a suffix such as '-ness' of '-ity'. For example, 'hot' relates to 'hotness', 'wide' relates to 'wideness'. | ||
# - `present_participle`: This means that the adjective is derived from a verb meaning performing the action currently or repeatedly. The adjective is often the '-ing' form of the verb. For example, 'running' relates to 'run'. | ||
# - `past_participle`: This means as a result of the verb and is mostly the '-ed' form of the verb. For example, 'run' relates to 'ran'. | ||
# - `potential`: This means that it is possible for this verb to be done to something and is often the '-able' form of the verb. For example, 'readable' relates to 'read'. | ||
# - `lack`: The adjective means the lack of something, and often corresponds to the '-less' form of the adjective. For example, 'careless' relates to 'care'. | ||
# - `fullness`: The adjective means being full of something, and often corresponds to the '-ful' form of the adjective. For example, 'careful' relates to 'care'. | ||
# - `resembles`: The adjective means it resembles something, and often corresponds to the '-like' form of the adjective. For example, 'childlike' relates to 'child'. | ||
""") | ||
toml.dump(data, f) | ||
data = {} | ||
i += 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
local json = require('json') | ||
-- Function to get the current word under the cursor and insert a message into the buffer | ||
local function greet_current_word() | ||
-- Get the current word under the cursor | ||
local current_word = vim.fn.expand('<cword>') | ||
|
||
-- If there is a word, insert the greeting message | ||
if current_word ~= "" then | ||
local greeting = "Hello, " .. current_word | ||
|
||
-- Get the current cursor position | ||
local row, col = unpack(vim.api.nvim_win_get_cursor(0)) | ||
|
||
-- Insert the greeting message at the cursor position | ||
vim.api.nvim_put({greeting}, 'l', true, true) | ||
else | ||
print("No word under cursor") | ||
end | ||
end | ||
|
||
-- Create a command to call the function | ||
vim.api.nvim_create_user_command( | ||
'GreetCurrentWord', | ||
greet_current_word, | ||
{ nargs = 0 } | ||
) | ||
|
||
-- Optionally, you can create a key mapping to call the command | ||
vim.api.nvim_set_keymap( | ||
'n', | ||
'<leader>g', | ||
':GreetCurrentWord<CR>', | ||
{ noremap = true, silent = true } | ||
) | ||
|