What is utteranceID parameter in Openears ios library callback? - openears

the callback of openears is
- (void) pocketsphinxDidReceiveHypothesis:(NSString *)hypothesis recognitionScore:(NSString *)recognitionScore utteranceID:(NSString *)utteranceID
hypothesis is the text itself and score is self explained. what is utteranceID?
thanks allot!

It doesn't mean anything significant, you can ignore this parameter. It is just an artifact of a very old pocketsphinx API.
Originally in pocketsphinx the API allowed to set the ID for every utterance it starts recognizing, so that in pocketsphinx log the recognized results are attributed to a certain wav file. Now there is no much need in that and this parameter will be removed from pocketsphinx API most likely.

Related

Is there a way to get help for some C functions inside of vim/Neovim?

This question may be a little off topic. But I was wondering if there was a way for me to look at the descriptions of C functions using vim or neovim. Is it possible to look at their documentations by doing something like :help? This would really be helpful since I wouldn't need to lookup to my browser everytime.
I am unclear about these things:
Can :help be my friend here ?
Can I use LSPs to do something like this ?
I am using latest Neovim inside Ubunutu 20.04 in WSL. Is this helpful somehow ?
By pressing K, the keyword under the cursor is looked up using a configured keyword lookup program, the default being man. This works pretty much out of the box for the C standard library.
For C++, you might want to look at something like cppman.
Well yes, you can get the description of C functions by using a LSP (language server plugin)! Here is an image of me using clangd as my LSP:
You'd "just" need to install the LSP and start it. I don't know how familiar you're with neovim, but just in case if you don't know how to install a plugin or to be more specifique: If you don't know how you can install a LSP server, then you can do the following:
There're plenty videos how to set up a LSP-Server for your language. Here's an example.
If you don't want to set up on your own, you can pick up one of the preconfigured neovim setups (some of my friends are recommending lunarvim)
But yeah, that's it. If you have any further questions feel free to ask them in the comments.
Happy vimming c(^-^)c
Let's explain how "K" command works in more detail.
You can run external commands by prefixing them with :! command. So running man tool is as easy as
:!man <C-R><C-W>
Here <C-R><C-W> is a special key combination used to put word under cursor from text buffer down to command line.
Same for showing Vim's built-in help page
:help <C-R><C-W>
As it feels tedious to type that, Vim also defines K Normal mode command that does pretty much the same thing. Except the tool name is taken from value of an option named "keywordprg".
So doing set keywordprg=man (default for *nix systems) makes K to invoke !man tool; while set keywordprg=:help is for bultin help.
Also, the option :h 'keywordprg' is made global or local-to-buffer, so any Vim buffer is able to overwrite global setting. For example, this is already done by standard runtime for "vim" and "help" buffers, so they call ":help" instead of "man".
The problem with :!man command is that it shows "black console". It'd be nice if we could capture man's output and open it inside Vim just like a builtin help page. Then we could also apply some pretty highlighting, assign key macros and all such. This is a pretty common trick and it is already done by a standard plugin shipped with Vim/Neovim.
A command that the plugin provides is called :Man, so you can open :Man man instead of :!man man, for example. The plugin is preactivated in Neovim; for Vim you still need to source one file manually. So to make use of this plugin you'll need something like this
set keywordprg=:Man
if !has("nvim")
source $VIMRUNTIME/ftplugin/man.vim
endif
The previous answer recommending cppman is the way to go. There is no need to install a bulky language server just for the purpose of having the hover functionality. However, make sure you're caching the man pages via cppman -c. Otherwise, there will be a noticeable delay since cppman is fetching the page from cppreference.com on the fly.
If you like popups for displaying documentation, convert the uncompressed man pages (groff -t -e -mandoc -Tascii <man-page> | col -bx), and set keywordprg to your own wrapper to search for keywords according to your needs.

How to add a new filter to ffmpeg library

I am trying to add functionality to FFmpeg library. The issue is that in developer guide there are just general instruction on how to do it. I know that when I want to add something to ffmpeg I need to register the new functionality and rebuild the library so I can then call it somehow like so:
ffmpeg -i input.avi -vf "myfilter" out.avi
I do not want to officialy contribute. I would like to try to create the extra functionality and test it. The question is - is there any scelet file where the basic structure would be ready and you would just get a pointer to a new frame and processed it? Some directions or anything, because the source files are kinda hard to read without understanding its functions it calls inside.
The document in the repo is worth a read: ffmpeg\doc\writing_filters.txt
The steps are:
Add an appropriate line to the: ffmpeg\libavfilter\Makefile
OBJS-$(CONFIG_MCSCALE_CUDA_FILTER) += vf_mcscale_cuda.o
vf_mcscale_cuda.ptx.o scale_eval.o
Add an appropriate line to the: ffmpeg\libacfilter\allfilters.c
extern AVFilter ff_vf_mcscale_cuda;
The change in (2) does not become recognized until ./configure scans the files again to configure the build, so run Configure and when you next run make the filter should be generated. Happy days.
i was faced with a problem to add transform_v1 filter (see details on transform 360 filters at https://www.diycode.cc/projects/facebook/transform360 ) to ffmpeg with the version N-91732-g1124df0. i did exactly according to writing_filters.txt but transform_v1.o is not linked?
i added the object file (vf_transform_v1.o) in Makefile of libavfilter.
OBJS-$(CONFIG_TRANSFORM_V1_FILTER)+= vf_transform_v1.o
i checked that the define CONFIG_TRANSFORM_V1_FILTER=1 is present in config.h .
However, after the compilation transform_v1 is still not recognized.
i resolved this issue in an awkward way, i added explicitly vf_transform_v1.o in OBJ-list without conditioning by the global define CONFIG_TRANSFORM_V1_FILTER:
OBJS+= vf_transform_v1.o

libxml to stdout when using fastcgi Library

We are attempting to create an XML feed using libxml, the code to produce the output is working fine, a valid XML listing is produced, the only problem is that the output goes to the error log (by way of stderr) rather than the required web page (by way of stdout) when using the fastcgi library. The same thing occurs whether the code is run using a browser or curl.
Versions/releases:
Fedora: release 20
Apache: 2.4.10
fastcgi:? the latest
libxml: 2
No code has been included with this question as I don't think it will help, the problem is with the fastcgi library 'taking over' stdout and libxml not acknowledging this, rather than with the code itself.
If a listing really is considered necessary then it could be added but will add verbosity without aiding clarity.
In short the question is 'how can we use libxml with fastcgi on Linux/Apache?'
EDIT:Probably would have helped had I mentioned that we are developing in C.
EDIT:Might also help knowing that we have tried all the output methods suggested in this standard libxml example, substituting '-' for a 'real' file name, so stdout is used instead. This has not aided our cause, output needs to go to fastcgi's 'cgiOut' alternative but goes to stderr in all cases.
EDIT:As far as I can see it is only possible to pass libxml a file name, not a handle, for where output should be sent. If output should go to stdout, the file name '-' is used, unfortunately, as stated above, output then goes to the error log. If it was possible to pass libxml a file handle (when using fastcgi this would be cgiOut) rather than a name then I suspect the problem would be resolved, but I cannot see any way this can be done.

Vim autocomplete from ctags for system headers only works when popup is triggered manually

On OS X, I generated a set of ctags for the system includes using the following command:
ctags -f c -h ".h" -R --c-kinds=+p --fields=+iaS --extra=+q /usr/include
This was run inside of a ~/.vim/ctags/ directory, where I put all of the ctags I generate for system-wide header files (I also have stuff for ROS and CPP that I load conditionally, but that's neither here nor there).
Anyway. The ctags file is set correctly in my .vimrc, and vim can definitely see the ctags, but for some reason the autocomplete popup will only display results from #included header files if I write out the entire symbol and then start backspacing. As an example, if I #include <string.h> in a project, and then I want to call strlen(), and I start to type str in to the active vim buffer, I will only get results for symbols that are currently in the vim buffer. But, if I type out strlen and then start backspacing one or two characters and hit <C-n>, the popup menu will be populated with matches from any other included header files.
EDIT: Turns out, if I just hit "s" then <C-n>, it works as well. So the problem seems to be that it only works if the popup menu is launched manually. Which makes me think that it's a plugin problem (see below)
Additional information:
completeopt is set to completeopt=menuone,menu,preview,longest
I have OmniCppComplete, which I suppose could be interfering with the behavior. It is currently not being conditionally loaded for C++ files only. If you want me to edit and post my OmniCppComplete settings from my .vimrc, just ask.
I also have AutoComplPop installed, but I haven't done anything to configure it, so it's running with its default settings. Haven't really researched the plugin, so no idea if some of it's behavior could be interfering with the results.
I have AutoTag and TagBar installed, but those should only be fiddling with the current directory's local tagfile.
I'm honestly pretty new to Vim, and I just have no idea where to start debugging this issue, whether it be with a random plugin or with my .vimrc settings.
Vim has many specific completion mechanisms.
<C-n> and <C-p> use many sources defined by the complete option. By default, they will provide completion using the current and all loaded and unloaded buffers, tags and included files. While you can usually get quite useful suggestions with these, it is a bit of a "catch-all" solution: it is not reliable at all if you work on reasonably large projects.
<C-x><C-]> uses only tags so it may be a little more useful to you.
And there are many more, see :h ins-completion.
Omni completion is smarter: it typically runs a custom filetype-specific script that tries hard to provide meaningful completion. It is triggered by <C-x><C-o> and you can read about it in :h ft-c-omni. Omni completion is often a better choice when working with code.
Because you have two overlaping "auto"-completion plugins it's hard to say what completion mechanism is at work. You should disable those plugins and play around with the different completion mechanisms available to you.
I have not mastered this yet, but I do think the following observation may be of help.
Vim's default auto complete which can be quite noisy, often gets in the way of what you call with <C-x><C-o>. Specifically, I found myself calling up my tags based completions with <C-x><C-o> only to have them replaced with continued typing with Vim's default suggestions using my open buffers.
The suggestion of shutting off one of the plugins makes sense. In my case the key was how to shut down Vim's default behavior. I have seen several people (and to which I now include myself), set the length of the expression to a high number before triggering Vim's default. For me that is:
let g:deoplete#auto_complete_start_length = 99
... this way you eliminate the default layer of completions that comes and goes regardless of the commands you intended to inform your work.
This still feels like a hack but it helps keep my work focused on the tag-based completions.
FYI: I use NVIM on a Mac.

C: library for parsing configuration files and command line

I'm looking for some library with support for strict set of options (so non-existent options couldn't be set in config file) and possibility to also parse command line to override options from config file. Any ideas?
For command line, there is getopt or plentiful of code, some with more, some with less strange APIs, some in the form of open-codedness like getopt, others in table form with or without callback ability. As for config file, there is (lib)augeas if you need support for almost arbitrary formats.
Assuming you can use LGPL stuff in your project, there's http://www.hyperrealm.com/libconfig/, which appears, according to the docs, to have support in the API for setting values after a file has been parsed.

Resources