I think I'm not understanding the need for a plugin here -- why wouldn't you just do this manually in LR? Define a filter / smart collection that searches for .NEFs with less than 4 stars; select the result; delete. If you're concerned that a .NEF doesn't have the same star rating as its corresponding .JPG (a LR misfeature of stacks), you could use the Syncomatic plugin to ensure that they have the same rating.
The problem is that the NEFs and jpgs are shown in Lightroom as a single entity - the NEF. However, if I delete it, then it deletes both the NEF and jpg. I'm just trying to get rid of the large NEF, not the whole image. It is like there is a pseudo-stack because both files are linked but the option to unstack is grayed out.
I tried what you suggested in creating a smart collection (File type=raw; Rating less than 4 stars) but Lightroom says you can't delete directly from a smart collection. I then switched to a specific folder with the same selection still selected and did Delete Photos. This deleted both the NEF and the jpg. Ihad a backup of the folder so no harm done but this is what I was trying to avoid. Doing the same thing in a custom filter in the Library panel had the same result - both the NEF and jpg were deleted even though the filter said (File Type: Raw; Rating <= 3 stars). This is why I thought I would have to code a plugin.
Is there a way to select just the NEF and delete them?
If I manually delete the NEFs, I get the result I want, but this is extreemly tedious since I can't see the rating in Windows Explorer.
The problem is that the NEFs and jpgs are shown in Lightroom as a single entity
You can separate your NEFs and JPEGs, e.g. using RawPlusJpeg.
Afterward, you can use Relative Antics to delete all NEFs which have a rating of 4+, but only if their jpeg exists, and you can transfer the 4 rating to the jpeg at the same time if you want. You'll probably need a few lines of code in the lua text config file for all of that.
The problem is that the NEFs and jpgs are shown in Lightroom as a single entity - the NEF.
Ah, I forgot about that option. I turned off the option to pair JPEGs and raw files a long time ago, precisely because of issues like this. Often I export a JPEG back into the catalog, and it gets stacked with the raw as a separate image -- much easier for me to manage.