We have to take into consideration three important things:
1. Due to different backgrounds, musicians don't all indicate chords the same way. Some will use a capital "M" for major. Others will use a little triangle, or simply write "major." For minor chords, the most current are "min," a small case "m" or even a "-" sign.
2. For musical purposes, a composer could write "Cm" (C, Eb, G), when harmonically the composition would suggest a "C minor 7" or a "Cm maj7." Because of the fact that he is not playing the "7th," you will have to find what I call "the real value ofthe chord." You will be able to do so, looking at the key signature, looking at the melody, or looking at the preceding or following chords.
3. In order to understand the mechanics of improvisation, the first step is to pretend that all the chords are written with their "real value," and that they are out of context, meaning: no key signature, and they are not between any other chords. I will only mention the key signatures on three occasions: #1, when the chord is the same as the key of the key signature, meaning for example that in the key of F major you have an F major chord. #2, when the chord is the relative minor of the key, for example in the key of C major, you have an A minor chord. #3, if the chord is the third of the key, example, in the key of Ab major you have a C7 or Cm7 chord.
These examples should enable you to play any kind of music and any style. If in the future you encounter some chords that I did not mention on the preceding pages, try to use common sense. There are basically only three scales: For the Major chords it is Lydian, for the Minor chords, it is Dorian, for the Dominant 7th chords it is Mixolydian.
Knowing this, you must be able to construct any kind of scale to go with any kind of chord. Let's take for example Cmin maj7, you know that for a minor 7th chord the scale is Dorian: C, D, Eb, F, G, A, Bb, C. If you substitute the 7th (Bb) for a major 7th (B), your C Dorian scale will become a D Ionian Melodic Minor scale, which is the right scale for this type of chord.
In brief, when you try to memorize matching the chords and the modes, you should play the chord first and then compare it to the mode. In the case of a chord over a different bass note, like Am7/D (Am7 over a D on the bass), as a short cut, I usually pick the mode of the top chord, and look if the bass note is included in it. In this particular case, Am7 gives me an A Dorian which contains a D (A, B, C, D, E, F#, G, A). No problem. In fact if you play this scale starting from the D (D, E, F#, G, A, B, C, D), you will be playing a D Mixolydian.
Let's now take C7/F# (C7 over F# on the bass). C7 gives me a C Mixolydian (C, D, E, F, G, A, Bb, C). Here you will have to substitute the F for an F#, which is going to give you a C Lydian Mixolydian scale. If you play this scale starting from F# (F#, G, A, Bb, C, D, E, F#) you will be playing F# Super Locrian.
All this shows you that in the first example, Am7/D, you are dealing with some kind of D7, and in the second example, C7/F#, you are dealing with some sort of F# Altered. If you really want to get more precise, you should compare the notes of the chord to the bass note: Am7 = A, C, E, G. Compared to D, A is the 5th of D, C is the Dominant 7th, E is the 9th and G is the 4th. This gives you a D11/9 which requires a D Mixolydian as we already know!